]> gitweb.fperrin.net Git - djsite.git/blob - quotes/models.py
Initial draft of the quotes app
[djsite.git] / quotes / models.py
1 from django.db import models
2
3 # Create your models here.
4
5 class Author(models.Model):
6     name = models.CharField(max_length=100)
7
8     def __unicode__(self):
9         return self.name
10
11 class Tag(models.Model):
12     tag = models.CharField(max_length=100)
13
14     def __unicode__(self):
15         return self.tag
16
17     class Meta:
18         ordering = ("tag", )
19
20 class Quote(models.Model):
21     text = models.TextField()
22     author = models.ForeignKey(Author)
23     tags = models.ManyToManyField(Tag, blank=True)
24
25     def __unicode__(self):
26         return self.author.name + ": " + self.text
27