#28988: Multi-table inheritance breaks GenericRelation querying
-----------------------------------------+------------------------
               Reporter:  robwa          |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  1.11
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 Minimal example to reproduce. Create two models:

 {{{
 #!python
 class Generic(models.Model):
     content_type = models.ForeignKey('contenttypes.ContentType')
     object_id = models.PositiveIntegerField()
     obj = GenericForeignKey()

 class Vehicle(models.Model):
     associations = GenericRelation('Generic',
 related_query_name='vehicles')
 }}}

 Create a `Vehicle` and a `Generic` object pointing to the `Vehicle`. The
 following query returns the expected result:

 {{{
 In [2]: Generic.objects.filter(vehicles__id=1)
 Out[2]: <QuerySet [<Generic: Generic object>]>
 }}}

 Add a third model. Don't change any data. Now the query returns an empty
 query set:

 {{{
 #!python
 class Bike(Vehicle):
     pass
 }}}

 {{{
 In [2]: Generic.objects.filter(vehicles__id=1)
 Out[2]: <QuerySet []>
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28988>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.6f6259f40c799c69178c11f79f5b5d19%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to