1 from django.db import models
2 from django.contrib.auth.models import User
6 class Ingredient(models.Model):
7 name = models.CharField(max_length=100)
8 slug = models.SlugField()
10 def __unicode__(self):
13 class Sandwich(models.Model):
14 adjective = models.CharField(max_length=200)
15 slug = models.SlugField()
16 date_made = models.DateField()
17 ingredients = models.ManyToManyField(Ingredient)
18 date_added = models.DateTimeField(default=datetime.datetime.now, editable=False)
19 picture = models.ImageField(upload_to='sandwiches/')
20 notes = models.TextField()
21 user = models.ForeignKey(User)
24 ordering = ['date_added']
25 verbose_name_plural = "Sandwiches"
27 def __unicode__(self):