from django.db import models class Ingredient(models.Model): name = models.CharField(max_length=128) def __str__(self): return self.name class Recipe(models.Model): name = models.CharField(max_length=128) ingredients = models.ManyToManyField(Ingredient, through='IngredientUsage') protocol = models.TextField(default='') def __str__(self): return self.name class IngredientUsage(models.Model): recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE) ingredient = models.ForeignKey(Ingredient, on_delete=models.CASCADE) quantity = models.CharField(max_length=64)