Try using related_name
:
class Test(models.model):
example1 = models.ForeignKey('Example', related_name="example1")
example2 = models.ForeignKey('Example', related_name="example2")
More Related Contents:
- Extending the User model with custom fields in Django
- When saving, how can you check if a field has changed?
- How to define two fields “unique” as couple
- How to express a One-To-Many relationship in Django?
- Django – Circular model import issue
- How to filter empty or NULL names in a QuerySet?
- How to view corresponding SQL query of the Django ORM’s queryset?
- Setting the selected value on a Django forms.ChoiceField
- In a django model custom save() method, how should you identify a new object?
- Unique fields that allow nulls in Django
- Django: Set foreign key using integer?
- Django ModelForm: What is save(commit=False) used for?
- Django migrate –fake and –fake-initial explained
- django – get() returned more than one topic
- Django custom managers – how do I return only objects created by the logged-in user?
- Django: Validate file type of uploaded file
- How to add data into ManyToMany field?
- Raw SQL queries in Django views
- Django data migration when changing a field to ManyToMany
- Django model: delete() not triggered
- Django accessing ManyToMany fields from post_save signal
- Dropdown in Django Model
- how to show datepicker calendar on datefield
- How to query Case-insensitive data in Django ORM?
- Django comparing model instances for equality
- Django: Does prefetch_related() follow reverse relationship lookup?
- Django Order By Date, but have “None” at end?
- How to add Check Constraints for Django Model fields?
- Django Migrations Add Field with Default as Function of Model
- how to write a query to get find value in a json field in django