Sunday, 8 September 2013

Filter multi-table inheritance in django

Filter multi-table inheritance in django

I want to make a dynamic filter for multi-table inheritance.
class Product(models.Model):
name ...
class Product1(Product):
color ...
class Product2(Product):
length ...
tags = ManyToManyField('tags.Tag')
How to filter so as not to cause an exception "missing field"?
Product.objects.filter(***__color='11', ***__length='300',
**__tags__pk__in=[1, 2])

No comments:

Post a Comment