##// END OF EJS Templates
Include tags that have only archived threads to the general tags list
Include tags that have only archived threads to the general tags list

File last commit:

r690:a8dffe47 1.8-dev
r700:7ec0b915 1.8-dev
Show More
ban.py
24 lines | 763 B | text/x-python | PythonLexer
neko259
Moved ban view to class-based
r553 from django.db import transaction
neko259
Minor style fixes to view classes. Fixed ban view
r561 from django.shortcuts import get_object_or_404
neko259
Implemented search over posts. Moved get_user and get_theme to utils module. Use context processors instead of creating context in the base view. Removed unused imports in some modules
r690 from boards import utils
neko259
Moved ban view to class-based
r553
from boards.views.base import BaseBoardView
from boards.models import Post, Ban
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563 from boards.views.mixins import RedirectNextMixin
neko259
Moved ban view to class-based
r553
neko259
Minor style fixes to view classes. Fixed ban view
r561
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563 class BanUserView(BaseBoardView, RedirectNextMixin):
neko259
Moved ban view to class-based
r553
@transaction.atomic
def get(self, request, post_id):
neko259
Implemented search over posts. Moved get_user and get_theme to utils module. Use context processors instead of creating context in the base view. Removed unused imports in some modules
r690 user = utils.get_user(request)
neko259
Moved ban view to class-based
r553 post = get_object_or_404(Post, id=post_id)
if user.is_moderator():
# TODO Show confirmation page before ban
ban, created = Ban.objects.get_or_create(ip=post.poster_ip)
if created:
ban.reason = 'Banned for post ' + str(post_id)
ban.save()
return self.redirect_to_next(request)