How do I collect a bunch of Django abstract models in a QuerySet?
- by Thierry Lam
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?