##// END OF EJS Templates
Added tag 2.5.2 for changeset d528d76d3242
Added tag 2.5.2 for changeset d528d76d3242

File last commit:

r730:447bb8d7 2.0-dev
r1022:1cd13cc5 default
Show More
ban.py
26 lines | 883 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
Moved ban view to class-based
r553
neko259
Divided settings manager into base settings manager class and session-based settings manager. This allowes to add other backends to the settings manager
r730 from boards.abstracts.settingsmanager import PERMISSION_MODERATE, \
get_settings_manager
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):
post = get_object_or_404(Post, id=post_id)
neko259
Divided settings manager into base settings manager class and session-based settings manager. This allowes to add other backends to the settings manager
r730 settings_manager = get_settings_manager(request)
neko259
Removed user and settings mode. Added settings manager to manage settings and keep them in the session (or any other backend like cookie in the future
r728
if settings_manager.has_permission(PERMISSION_MODERATE):
neko259
Moved ban view to class-based
r553 # 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)