def render_to_response(self, context): if permissions.can_user_edit_blogpost(self.request.user, context['blog']): return UpdateView.render_to_response(self, context) else: return HttpResponseForbidden('You do not have permission to edit this blog post.')
def can_edit_blogpost(user, blogpost): return permissions.can_user_edit_blogpost(user, blogpost)