+class BaseTag(models.Model):
+ tag = models.CharField(max_length=100, unique=True)
+
+ def __unicode__(self):
+ return self.tag
+
+ class Meta(object):
+ abstract = True
+
+class AuthorTag(BaseTag): pass
+class WorkTag(BaseTag): pass
+class QuoteTag(BaseTag):
+ def get_absolute_url(self):
+ return reverse('quotes:tags', args=[str(self.id)])
+
+class CommonData(models.Model):
+ creation_date = models.DateTimeField(auto_now_add=True)
+ last_modification = models.DateTimeField(auto_now=True)
+
+ notes = HTMLField(blank=True, help_text= \
+ "Notes about the entry; may be left blank. Displayed \
+ on the public pages")
+ pvt_notes = HTMLField(blank=True, help_text= \
+ "Notes about the entry; not displayed on \
+ the public interface")
+
+ nb_display = models.BigIntegerField(default=0)
+ def incr_display(self):
+ self.nb_display = models.F('nb_display') + 1
+ self.save()
+
+ class Meta(object):
+ abstract = True
+
+class Author(CommonData):
+ name = models.CharField(max_length=100,
+ help_text="Name of the author",
+ unique=True)