summaryrefslogtreecommitdiff
path: root/app/jrnl
diff options
context:
space:
mode:
Diffstat (limited to 'app/jrnl')
-rw-r--r--app/jrnl/models.py47
1 files changed, 24 insertions, 23 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index 5290e37..8e86c62 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -195,7 +195,6 @@ class BlogSitemap(Sitemap):
return obj.pub_date
-
import urllib.request
import urllib.parse
import urllib.error
@@ -213,34 +212,36 @@ class EntryModerator(CommentModerator):
email_notification = True
def moderate(self, comment, content_object, request):
- previous_approvals = Comment.objects.filter(user_email=comment.email, is_public=True).count()
- if previous_approvals > 2:
+ previous_approvals = Comment.objects.filter(user_email=comment.email, is_public=True)
+ for approval in previous_approvals:
+ if approval.submit_date <= datetime.datetime.today() - datetime.timedelta(21):
+ approve = True
+ if previous_approvals.count() > 2 and approve:
return False
# do entry build right here so it goes to live site
return True
moderator.register(Entry, EntryModerator)
-from django_comments.signals import comment_will_be_posted
-from django_comments import akismet
-
-
-@receiver(comment_will_be_posted, sender=Comment)
-def spam_check(sender, comment, request, **kwargs):
- akismet.USERAGENT = "David Lynch's Python library/1.0"
-
- try:
- real_key = akismet.verify_key(settings.AKISMET_KEY, "https://luxagraf.net/")
- if real_key:
- is_spam = akismet.comment_check(settings.AKISMET_KEY, "https://luxagraf.net/", request.META['REMOTE_ADDR'], request.META['HTTP_USER_AGENT'], comment_content=comment.comment)
- if is_spam:
- return False
- else:
- return True
- except akismet.AkismetError as e:
- print('Something went wrong, allowing comment')
- print(e.response, e.statuscode)
- return True
+# from django_comments.signals import comment_will_be_posted
+# from django_comments import akismet
+
+
+# @receiver(comment_will_be_posted, sender=Comment)
+# def spam_check(sender, comment, request, **kwargs):
+# akismet.USERAGENT = "David Lynch's Python library/1.0"
+# try:
+# real_key = akismet.verify_key(settings.AKISMET_KEY, "https://luxagraf.net/")
+# if real_key:
+# is_spam = akismet.comment_check(settings.AKISMET_KEY, "https://luxagraf.net/", request.META['REMOTE_ADDR'], request.META['HTTP_USER_AGENT'], comment_content=comment.comment)
+# if is_spam:
+# return False
+# else:
+# return True
+# except akismet.AkismetError as e:
+# print('Something went wrong, allowing comment')
+# print(e.response, e.statuscode)
+# return True
@receiver(comment_was_posted, sender=Comment)