2017-02-14 21:23:45 +03:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
|
|
|
class Category(models.Model):
|
2018-10-18 21:33:53 +03:00
|
|
|
class Meta:
|
2019-06-11 06:54:30 +03:00
|
|
|
verbose_name_plural = "Categories"
|
|
|
|
|
2017-02-14 21:23:45 +03:00
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
|
|
|
|
class Ingredient(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
notes = models.TextField(null=True, blank=True)
|
2019-06-11 06:54:30 +03:00
|
|
|
category = models.ForeignKey(
|
|
|
|
Category, related_name="ingredients", on_delete=models.CASCADE
|
|
|
|
)
|
2017-02-14 21:23:45 +03:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|