#18012: Propagate reverse foreign keys from proxy models to base class
-------------------------------------+-------------------------------------
Reporter: Anssi Kääriäinen | Owner: Simon
Type: | Charette
Cleanup/optimization | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Shai Berger):
For the record and for future considerations, this did carry a backwards
incompatibility. Consider:
{{{
class User(models.Model):
pass # Really all sorts of details, which do not matter
class Teacher(User):
class Meta:
proxy=True
class Student(User):
class Meta:
proxy=True
class Class(models.Model):
teacher = models.ForeignKey(Teacher, related_name='classes')
students = models.ManyToMany(Student, related_name='classes')
}}}
This works before this was fixed; after the fix, the related name
`'classes'` gets propagated to `User` twice, and it breaks.
(I admit that this design is somewhat flawed, but it used to be valid, and
it isn't anymore)
--
Ticket URL: <https://code.djangoproject.com/ticket/18012#comment:31>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.1e96c5539ed0ec63f1d055b7deb83c86%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.