MCPcopy
hub / github.com/django/django / get_related_field

Method get_related_field

django/db/models/fields/reverse_related.py:298–307  ·  view source on GitHub ↗

Return the Field in the 'to' object to which this relationship is tied.

(self)

Source from the content-addressed store, hash-verified

296 return (*super().identity, self.field_name)
297
298 def get_related_field(self):
299 """
300 Return the Field in the 'to' object to which this relationship is tied.
301 """
302 field = self.model._meta.get_field(self.field_name)
303 if not field.concrete:
304 raise exceptions.FieldDoesNotExist(
305 "No related field named '%s'" % self.field_name
306 )
307 return field
308
309 def set_field_name(self):
310 self.field_name = self.field_name or self.model._meta.pk.name

Callers 10

to_field_allowedMethod · 0.45
get_contextMethod · 0.45
url_parametersMethod · 0.45
get_contextMethod · 0.45
_get_to_pythonMethod · 0.45
get_path_to_parentMethod · 0.45
prepare_database_saveMethod · 0.45
get_choicesMethod · 0.45

Calls 1

get_fieldMethod · 0.45

Tested by 1