#12885: GenericRelation fails to join the related table from a inherited model
-----------------------------+----------------------------------------------
 Reporter:  semenov          |       Owner:            
   Status:  new              |   Milestone:            
Component:  ORM aggregation  |     Version:  1.1       
 Keywords:                   |       Stage:  Unreviewed
Has_patch:  0                |  
-----------------------------+----------------------------------------------
 A minimalistic crashing example is worth thousands words:
 {{{
 #!python
 class Car(models.Model):
         content_type = models.ForeignKey(ContentType)
         object_id = models.PositiveIntegerField()
         object = generic.GenericForeignKey()

 class CarDriver(models.Model):
         cars = generic.GenericRelation(Car)

 class Truck(Car):
         pass

 class TruckDriver(models.Model):
         trucks = generic.GenericRelation(Truck)

 # Selecting cars for a car drivers works fine

 >>> john = CarDriver.objects.create()
 >>> Car.objects.filter(cardriver=john)
 []

 # Selecting trucks for a truck driver crashes

 >>> pete = TruckDriver.objects.create()
 >>> Truck.objects.filter(truckdriver=pete)
 # OperationalError: (1054, "Unknown column 'T2.object_id' in 'where
 clause'")
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12885>
Django <http://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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to