Commits

Adam Knight committed 7a7f464

To the office, Batman!

Comments (0)

Files changed (1)

 		#FIXME: owner won't work here, need to search by ID and PK
 		return ContentHistory.objects.filter(owner=owner, field_name=field).order_by('-date_created')
 
+### COMMENTS ###
+
+from mptt.models import MPTTModel, TreeForeignKey
+
+class Comment(MPTTModel):
+    """ Threaded comments for blog posts """
+    post = models.ForeignKey(Post)
+    author = models.CharField(max_length=60)
+    comment = models.TextField()
+    added  = models.DateTimeField(default=datetime.now)
+    # a link to comment that is being replied, if one exists
+    parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
+
+    class MPTTMeta:
+        # comments on one level will be ordered by date of creation
+        order_insertion_by=['added']