#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 Paulo):

 I think the behavior should be consistent with how a normal ForeignKey
 field behaves in multi-table inheritance.
 In the following scenario:


 {{{
 class Car(models.Model):
     owner = models.ForeignKey(Owner, related_name='cars')
     some_id = models.CharField(max_length=100)

 class Car2(Car):
     pass
 }}}


 Running
 {{{
 Owner.objects.filter(cars__isnull=True)
 }}}


 Will output:

 {{{
 SELECT "paulotest_owner"."id",
        "paulotest_owner"."nick"
 FROM "paulotest_owner"
 LEFT OUTER JOIN "paulotest_car" ON ("paulotest_owner"."id" =
 "paulotest_car"."owner_id")
 WHERE "paulotest_car"."id" IS NULL
 }}}

 So we should prevent the reverse relationship from being set.

 @Robert, if you would like to work on this, I can un-assign it, I'm
 planning to tackle it within the next two weeks.

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

Reply via email to