]> gitweb.fperrin.net Git - djsite.git/blobdiff - quotes/models.py
Initial draft of the quotes app
[djsite.git] / quotes / models.py
index 71a836239075aa6e6e4ecb700e9c42c95c022d91..9791aa0b093b00eb924a76d8b0b52e1ac98574b2 100644 (file)
@@ -1,3 +1,27 @@
 from django.db import models
 
 # Create your models here.
+
+class Author(models.Model):
+    name = models.CharField(max_length=100)
+
+    def __unicode__(self):
+        return self.name
+
+class Tag(models.Model):
+    tag = models.CharField(max_length=100)
+
+    def __unicode__(self):
+        return self.tag
+
+    class Meta:
+        ordering = ("tag", )
+
+class Quote(models.Model):
+    text = models.TextField()
+    author = models.ForeignKey(Author)
+    tags = models.ManyToManyField(Tag, blank=True)
+
+    def __unicode__(self):
+        return self.author.name + ": " + self.text
+