##// END OF EJS Templates
Added info about attachments
Added info about attachments

File last commit:

r730:447bb8d7 2.0-dev
r840:78400567 decentral
Show More
delete_post.py
28 lines | 953 B | text/x-python | PythonLexer
neko259
Moved delete view to class-based views
r552 from django.shortcuts import redirect, get_object_or_404
from django.db import transaction
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 delete view to class-based views
r552 from boards.views.base import BaseBoardView
neko259
Moved tag subscribe and unsubscribe methods to the tag view. Added a...
r563 from boards.views.mixins import RedirectNextMixin
neko259
Moved delete view to class-based views
r552 from boards.models import Post
neko259
Minor style fixes to view classes. Fixed ban view
r561
neko259
Moved delete view to class-based views
r552 class DeletePostView(BaseBoardView, RedirectNextMixin):
@transaction.atomic
def get(self, request, post_id):
post = get_object_or_404(Post, id=post_id)
opening_post = post.is_opening()
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 delete view to class-based views
r552 # TODO Show confirmation page before deletion
Post.objects.delete_post(post)
if not opening_post:
thread = post.thread_new
return redirect('thread', post_id=thread.get_opening_post().id)
else:
return self.redirect_to_next(request)