##// END OF EJS Templates
Moved post image to a separate model. Each post (as of model) can contain multiple images now. The image shown to the user is got with get_first_image method
Moved post image to a separate model. Each post (as of model) can contain multiple images now. The image shown to the user is got with get_first_image method

File last commit:

r690:a8dffe47 1.8-dev
r693:641dff39 1.8-dev
Show More
delete_post.py
27 lines | 835 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
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 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):
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 delete view to class-based views
r552 post = get_object_or_404(Post, id=post_id)
opening_post = post.is_opening()
if user.is_moderator():
# 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)