##// END OF EJS Templates
Moved signatures block to the model block. All the signed content is in the 'content' block now. Removed edit time, previous and next posts links from the XML sync output because they can be computed from the post itself and can be changed locally for foreign posts (which breaks the signature)
Moved signatures block to the model block. All the signed content is in the 'content' block now. Removed edit time, previous and next posts links from the XML sync output because they can be computed from the post itself and can be changed locally for foreign posts (which breaks the signature)

File last commit:

r730:447bb8d7 2.0-dev
r838:2b96b9e7 decentral
Show More
delete_post.py
28 lines | 953 B | text/x-python | PythonLexer
from django.shortcuts import redirect, get_object_or_404
from django.db import transaction
from boards.abstracts.settingsmanager import PERMISSION_MODERATE,\
get_settings_manager
from boards.views.base import BaseBoardView
from boards.views.mixins import RedirectNextMixin
from boards.models import Post
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()
settings_manager = get_settings_manager(request)
if settings_manager.has_permission(PERMISSION_MODERATE):
# 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)