X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/95a37db8ae5eb7c22eacda134cf396c8ca50f70a..d08b51a20f492d3b62b9494b2dbeba0e162564ce:/prawokultury/models.py diff --git a/prawokultury/models.py b/prawokultury/models.py new file mode 100644 index 0000000..c759e4d --- /dev/null +++ b/prawokultury/models.py @@ -0,0 +1,33 @@ +from django.conf import settings +from django.contrib.comments.signals import comment_will_be_posted +import re + +def spamfilter(sender, comment, **kwargs): + return False + ban = [ +'cialis', +'viagra', 'generic', 'first time', 'genital', 'ficken', 'cheap', 'affiliate', 'herpes', ' your blog ' +'priceless', +'find out more', +' product ', +' concerns ', +'cheats', +'this site', +'fantastic read', +'features', +'your website', +'this blog', +'this info', +'thank you', +'thanks', +'tips and tricks', +] + for b in ban: + if b in comment.user_name.lower(): return False + if b in comment.user_url.lower(): return False + if b in comment.comment.lower(): return False + if 'http://' in comment.user_name.lower(): return False + return comment.ip_address not in getattr(settings, 'COMMENTS_IP_BLOCKED', ()) +comment_will_be_posted.connect(spamfilter) + +