diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 8eab18b0c2320..3e03f2cc71e56 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -637,6 +637,14 @@ def __init__(self, to, related_name=None, limit_choices_to=None, self.multiple = True self.through = through + def get_related_field(self): + """ + Returns the field in the to' object to which this relationship is tied + (this is always the primary key on the target model). Provided for + symmetry with ManyToOneRel. + """ + return self.to._meta.pk + class ForeignKey(RelatedField, Field): empty_strings_allowed = False def __init__(self, to, to_field=None, rel_class=ManyToOneRel, **kwargs):