X-Git-Url: http://gitweb.fperrin.net/?p=djsite.git;a=blobdiff_plain;f=quotes%2Fmodels.py;h=0fa66afd0ed91e8e076bd7d674c068246ef09b46;hp=7539152451509845f8e984c31bbd16c2dd4ddb69;hb=1beb1e7de4e076707eedf1be7386b238f19aeb60;hpb=5c563ff1701456a2ca7108a301e4e48457475daa diff --git a/quotes/models.py b/quotes/models.py index 7539152..0fa66af 100644 --- a/quotes/models.py +++ b/quotes/models.py @@ -1,7 +1,12 @@ from django.db import models -from localmodels import HTMLField, TagField +from localmodels import HTMLField # Create your models here. +class Tag(models.Model): + tag = models.CharField(max_length=100) + def __unicode__(self): + return self.tag + class Author(models.Model): name = models.CharField(max_length=100, help_text="Name of the author") @@ -11,7 +16,7 @@ class Author(models.Model): pvt_notes = HTMLField(blank=True, help_text= \ "Notes about the author; not displayed on \ the public interface",) - tags = TagField() + tags = models.ManyToManyField(Tag, blank=True) birth_date = models.DateField(blank=True, null=True, help_text="Date of birth") @@ -48,7 +53,7 @@ class Work(models.Model): author = models.ForeignKey(Author) date = models.DateField(blank=True, null=True, help_text="Date of the quote") - tags = TagField() + tags = models.ManyToManyField(Tag, blank=True) notes = HTMLField(blank=True, help_text= \ "Notes about the work; may be left blank. Will \ @@ -62,7 +67,7 @@ class Work(models.Model): class Quote(models.Model): text = HTMLField() - tags = TagField() + tags = models.ManyToManyField(Tag, blank=True) work = models.ForeignKey(Work) notes = HTMLField(blank=True, help_text= \