]> gitweb.fperrin.net Git - djsite.git/blob - quotes/models.py
Add the possibility of attaching notes to an author
[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     notes = models.TextField(blank=True, help_text= \
8                              "Notes for the author; may be left blank. Will \
9                               not be HTML-escaped.")
10
11     def __unicode__(self):
12         return self.name
13
14 class Tag(models.Model):
15     tag = models.CharField(max_length=100)
16
17     def __unicode__(self):
18         return self.tag
19
20     class Meta:
21         ordering = ("tag", )
22
23 class Quote(models.Model):
24     text = models.TextField()
25     author = models.ForeignKey(Author)
26     tags = models.ManyToManyField(Tag, blank=True)
27
28     def __unicode__(self):
29         return self.author.name + ": " + self.text
30