Recipes phase 6
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user