Return content type of child class when parent passed to ContentType.objects.get_for_model
|Reported by:||Alexander Artemenko||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
There is a problem during inheritance, if I have:
class Parent(models.Model): pass class Child(Parent): pass class Child2(Parent): pass
Next create objects of Child and Child2 types.
After that for each of Parent.objects.all() I want to receive it's ContentType. Obviously, that in case of this inheritance, I need to get ContentType of Child or Child2 instead of Parent.
My patch add this 'virtual' behaviour to get_for_model method. Also it includes two unittests for this behaviour.
Change History (2)
Changed 9 years ago by