Return the Field in the 'to' object to which this relationship is tied.
(self)
| 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 |