How do I collect a bunch of Django abstract models in a QuerySet?

Posted by Thierry Lam on Stack Overflow See other posts from Stack Overflow or by Thierry Lam
Published on 2010-03-16T21:02:07Z Indexed on 2010/03/16 21:11 UTC
Read the original article Hit count: 183

Filed under:

I have the following abstract Django models:

class Food(models.Model):
    name = models.CharField(max_length=100)

    class Meta:
        abstract = True

In one of my view, I created a bunch of Food model:

panino = Food(name='Panino')
poutine = Food(name='Poutine')

food = [panino, poutine]

From the above, I'm not saving the model and storing the Food model in a regular Python list. I want to store the above food models in a QuerySet object. How can I do that without storing any data to the database?

© Stack Overflow or respective owner

Related posts about django