def get_object(self, queryset=None): post = get_object_or_404(Post.objects.select_related("topic", "topic__forum"), pk=self.kwargs["pk"]) if not perms.may_delete_post(self.request.user, post): raise PermissionDenied self.topic = post.topic self.forum = post.topic.forum return post
def get_object(self, queryset=None): post = get_object_or_404(Post.objects.select_related('topic', 'topic__forum'), pk=self.kwargs['pk']) if not perms.may_delete_post(self.request.user, post): raise PermissionDenied self.topic = post.topic self.forum = post.topic.forum if not perms.may_moderate_topic(self.request.user, self.topic): raise PermissionDenied return post
def get_object(self, queryset=None): post = get_object_or_404(Post.objects.select_related( 'topic', 'topic__forum'), pk=self.kwargs['pk']) if not perms.may_delete_post(self.request.user, post): raise PermissionDenied self.topic = post.topic self.forum = post.topic.forum return post