#28988: Multi-table inheritance breaks GenericRelation querying
--------------------------------------+------------------------------------
     Reporter:  robwa                 |                    Owner:  Paulo
         Type:  Bug                   |                   Status:  assigned
    Component:  contrib.contenttypes  |                  Version:  1.11
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by robwa):

 Now I can see why this happens:

 * `GenericRelation` fields are created as ''private fields''.
 * ''Private fields'' are explicitly inherited by child classes
 
([https://github.com/django/django/blob/649d5eaa8b7b224fc0eb8a3339a589288d5b10e8/django/db/models/base.py#L290
 db.models.base]).
 * When constructing the relation tree, ''private fields'' are included
 
([https://github.com/django/django/blob/649d5eaa8b7b224fc0eb8a3339a589288d5b10e8/django/db/models/options.py#L858
 db.models.options]).
 * When constructing the fields map, relations to ''private fields'' of
 child classes simply overwrite the relations to the parents
 
([https://github.com/django/django/blob/649d5eaa8b7b224fc0eb8a3339a589288d5b10e8/django/db/models/options.py#L586
 db.models.options]).

 Where is the point to fix this?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28988#comment:4>
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/063.ba2a9d5544aca6444f3b6553e9912acb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to