]> gitweb.fperrin.net Git - djsite.git/blobdiff - quotes/models.py
Use django-tagging for tags
[djsite.git] / quotes / models.py
index 0fa66afd0ed91e8e076bd7d674c068246ef09b46..7539152451509845f8e984c31bbd16c2dd4ddb69 100644 (file)
@@ -1,12 +1,7 @@
 from django.db import models
-from localmodels import HTMLField
+from localmodels import HTMLField, TagField
 
 # 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")
@@ -16,7 +11,7 @@ class Author(models.Model):
     pvt_notes = HTMLField(blank=True, help_text= \
                           "Notes about the author; not displayed on \
                           the public interface",)
-    tags = models.ManyToManyField(Tag, blank=True)
+    tags = TagField()
 
     birth_date = models.DateField(blank=True, null=True,
                                   help_text="Date of birth")
@@ -53,7 +48,7 @@ class Work(models.Model):
     author = models.ForeignKey(Author)
     date = models.DateField(blank=True, null=True,
                             help_text="Date of the quote")
-    tags = models.ManyToManyField(Tag, blank=True)
+    tags = TagField()
 
     notes = HTMLField(blank=True, help_text= \
                       "Notes about the work; may be left blank. Will \
@@ -67,7 +62,7 @@ class Work(models.Model):
 
 class Quote(models.Model):
     text = HTMLField()
-    tags = models.ManyToManyField(Tag, blank=True)
+    tags = TagField()
     work = models.ForeignKey(Work)
 
     notes = HTMLField(blank=True, help_text= \