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):
14 class Artist(models.Model):
15 name = models.CharField(max_length=150)
16 slug = models.SlugField()
17 bio = models.TextField()
19 def __unicode__(self):
23 class Sandwich(models.Model):
24 adjective = models.CharField(max_length=200)
25 slug = models.SlugField()
26 date_made = models.DateField()
27 ingredients = models.ManyToManyField(Ingredient)
28 date_added = models.DateTimeField(default=datetime.datetime.now, editable=False)
29 artist = models.ForeignKey(Artist, related_name='Artist')
30 patron = models.ForeignKey(Artist, related_name='Patron')
31 picture = models.ImageField(upload_to='sandwiches/')
32 notes = models.TextField()
33 user = models.ForeignKey(User)
36 ordering = ['date_added']
37 verbose_name_plural = "Sandwiches"
39 def __unicode__(self):