##// END OF EJS Templates
Run js highlight on the new posts only, not on all page each time. Add...
Run js highlight on the new posts only, not on all page each time. Add highlight to the reflink popups

File last commit:

r690:a8dffe47 1.8-dev
r709:e6788412 default
Show More
base.py
35 lines | 814 B | text/x-python | PythonLexer
from django.db import transaction
from django.template import RequestContext
from django.views.generic import View
from boards import utils
from boards.models.user import Ban
BAN_REASON_SPAM = 'Autoban: spam bot'
PARAMETER_FORM = 'form'
class BaseBoardView(View):
def get_context_data(self, **kwargs):
request = kwargs['request']
# context = self._default_context(request)
context = RequestContext(request)
return context
@transaction.atomic
def _ban_current_user(self, request):
"""
Add current user to the IP ban list
"""
ip = utils.get_client_ip(request)
ban, created = Ban.objects.get_or_create(ip=ip)
if created:
ban.can_read = False
ban.reason = BAN_REASON_SPAM
ban.save()