Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Ingredient(models.Model):
- name = models.CharField(max_length=255)
- class Recipe(models.Model):
- name = models.CharField(max_length=255)
- ingredients = models.ManyToManyField(Ingredient)
- count = 0
- for recipe in Recipe.objects.all():
- count += recipe.ingredients.count()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement