]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/blog/models.py
Stop double escaping the title in the feed
[sommitrealweird.git] / sommitrealweird / blog / models.py
index 16347546e110e58a1f93fec0b4a5db79b9da82be..f76de3080a29322905960213437ff166333cba37 100644 (file)
@@ -1,3 +1,4 @@
+from django.contrib.comments.moderation import CommentModerator, moderator
 from django.db import models
 from django.conf import settings
 from django.contrib import admin
 from django.db import models
 from django.conf import settings
 from django.contrib import admin
@@ -28,6 +29,17 @@ class BlogEntry(models.Model):
     class Meta:
         ordering = ['-publish_date']
 
     class Meta:
         ordering = ['-publish_date']
 
+class BlogEntryCommentModerator(CommentModerator):
+    email_notification = True
+
+    def moderate(self, comment, content_object, request):
+        if request.user.is_authenticated():
+            return False
+        else:
+            return True
+
+moderator.register(BlogEntry, BlogEntryCommentModerator)
+
 class BlogSection(models.Model):
     title = models.CharField(max_length=150)
     slug = models.SlugField()
 class BlogSection(models.Model):
     title = models.CharField(max_length=150)
     slug = models.SlugField()