Abstract model managers should return subclass instances
|Reported by:||Jeremy Dunck||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Suppose a base:
class Document(Model): title = CharField() class Meta: abstract = True class Presentation(Document): num_kitten_pictures = IntegerField() class Spreadsheet(Document): num_pie_charts = IntegerField()
It would be useful if Documents.objects.filter(title='x') returned instances of both Presentation and Spreadsheet whose title was 'x'.
I'd expect support only for base-class fields. This should be safe, since inheritance should follow an is-a relationship.