Login view works! Forms have been reshuffled (Django apparently comes with built...
[~kgodey/maayanwich.git] / models.py
1 from django.db import models
2 from django.contrib.auth.models import User
3 import datetime
4
5
6 class Ingredient(models.Model):
7         name = models.CharField(max_length=100)
8         slug = models.SlugField()
9         
10         def __unicode__(self):
11                 return self.name
12
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)
22         
23         class Meta:
24                 ordering = ['date_added']
25                 verbose_name_plural = "Sandwiches"
26                 
27         def __unicode__(self):
28                 return self.adjective