-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
29 lines (24 loc) · 849 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from django.db import models
# define Recipe Type
RECIPE_TYPE = (
('Cookies', 'Cookies'),
('Cakes', 'Cakes'),
('Pies', 'Pies'),
('Cupcakes','Cupcakes'),
('Bars','Bars'),
('Cheesecakes','Cheesecakes'),
('Brownies','Brownies'),
('Other','Other')
)
# Recipe class model
class Recipe(models.Model):
category = models.CharField(max_length=20, choices=RECIPE_TYPE, null=False)
name = models.CharField(max_length=50, default="", blank=True, null=False)
ingredients = models.TextField(max_length=1000, default="", blank=True, null=False)
method = models.TextField(max_length=1000, default="", blank=True, null=False)
servings = models.IntegerField(null=False)
# returns reference by recipe name
def __str__(self):
return self.name
# objects manager
Recipes = models.Manager()