Manager.raw() doesn't work with Multi-table inheritance
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
As far as I can tell the Manager.raw() function does not work with a subclassed model. I believe the raw function is looking for an 'id' field, and this does not exist in a subclassed table (instead of id, there is a <parent>_ptr_id field).
class Parent(models.Model) name = models.CharField(max_length=50) class Child(Parent) favorite_toy = models.CharField(max_length=50) # broken code Child.objects.raw("SELECT * FROM child")