update
[prawokultury.git] / prawokultury / models.py
1 from django.conf import settings
2 from django_comments.signals import comment_will_be_posted
3 import re
4
5 def spamfilter(sender, comment, **kwargs):
6     return False
7     ban = [
8 'cialis', 
9 'viagra', 'generic', 'first time', 'genital', 'ficken', 'cheap', 'affiliate', 'herpes', ' your blog '
10 'priceless',
11 'find out more',
12 ' product ',
13 ' concerns ',
14 'cheats',
15 'this site',
16 'fantastic read',
17 'features',
18 'your website',
19 'this blog',
20 'this info',
21 'thank you',
22 'thanks',
23 'tips and tricks',
24 ]
25     for b in ban:
26         if b in comment.user_name.lower(): return False
27         if b in comment.user_url.lower(): return False
28         if b in comment.comment.lower(): return False
29     if 'http://' in comment.user_name.lower(): return False
30     return comment.ip_address not in getattr(settings, 'COMMENTS_IP_BLOCKED', ())
31 comment_will_be_posted.connect(spamfilter)
32
33