Changes between Initial Version and Version 2 of Ticket #31310
- Timestamp:
- Feb 26, 2020, 6:33:01 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31310 – Description
initial v2 1 When there's more than 2 ForeignKeys pointing to the same modelin an intermediary model of a m2m field and no through_fields have been set, Django will show an error with the following hint:1 When there's more than 2 ForeignKeys in an intermediary model of a m2m field and no through_fields have been set, Django will show an error with the following hint: 2 2 {{{#!python 3 3 hint=( … … 5 5 'use ForeignKey("%s", symmetrical=False, through="%s").' 6 6 }}} 7 But to create a recursive relationship the ManyToManyField should be used instead of ForeignKey. Also symmetrical=False should only be used with m2m fields, according to model field reference (link: https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.ManyToManyField.symmetrical). And more than that, setting symmetrical=False is not required for recursive relationships since Django >= 3.0.7 But 'symmetrical' and 'through' are m2m keyword arguments, not ForeignKey. 8 8 9 This was probably a small mistake where the developer thought ManyToManyField but typed ForeignKey instead. And the symmetrical=False is an outdated requirement to recursive relationships, not applicable since 3.0. I'll provide a PR with a proposed correction shortly after. 9 This was probably a small mistake where the developer thought ManyToManyField but typed ForeignKey instead. And the symmetrical=False is an outdated requirement to recursive relationships with intermediary model to self, not required since 3.0. I'll provide a PR with a proposed correction shortly after. 10 11 Edit: fixed description.