Recipes phase 6

This commit is contained in:
Joren de Graaf
2026-10-12 16:25:58 +02:00
parent fe66dde2fb
commit 2934662d7a
14 changed files with 425 additions and 2 deletions
+14
View File
@@ -76,6 +76,20 @@ class Recipe(models.Model):
return self.title
class RecipeSelection(models.Model):
"""One user's selection of an existing recipe for the matching demo."""
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE,
related_name='recipe_match_selections')
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE,
related_name='match_selections')
selected_at = models.DateTimeField(auto_now_add=True)
class Meta:
constraints = [models.UniqueConstraint(fields=('user', 'recipe'),
name='recipes_unique_user_selection')]
class RecipeIngredient(models.Model):
class Unit(models.TextChoices):
GRAM = 'g', 'g'