def approve_page(page, user): """ Approve a page version. See docs/extending_cms/api_reference.rst for more info """ class FakeRequest(object): def __init__(self, user): self.user = user request = FakeRequest(user) moderator.approve_page(request, page) return Page.objects.get(pk=page.pk)
def approve_page(self, request, page_id): """Approve changes on current page by user from request. """ #TODO: change to POST method !! get is not safe page = get_object_or_404(Page, id=page_id) if not page.has_moderate_permission(request): raise Http404() approve_page(request, page) self.message_user(request, _('Page was successfully approved.')) if 'node' in request.REQUEST: # if request comes from tree.. return render_admin_menu_item(request, page) return HttpResponseRedirect('../../')