def post(self, request, pk):
        # Get page which is currently updated
        page = get_object_or_404(request.website.pages, pk=pk)
        # Saving url of current page
        old_url_current_page = request.page.get_absolute_url()
        # Settings Refresh
        refresh_manager = False
        refresh_page = False
        msg_user = None
        # ----------------------
        # Moving Page Management
        # ----------------------
        if 'move' in request.POST:
            if 'previous' in request.POST:
                page_top = get_object_or_404(request.website.pages, pk=request.POST['previous'])
                page.move_to(page_top, 'right')
            else:
                if 'next' in request.POST:
                    page_top = get_object_or_404(request.website.pages, pk=request.POST['next'])
                    page.move_to(page_top, 'left')
                else:
                    if 'parent' in request.POST:
                        page_top = get_object_or_404(request.website.pages, pk=request.POST['parent'])
                        page.move_to(page_top, 'first-child')
            # We save updates.
            page.save()
            # Ask refresh manager
            refresh_manager = True
            # Messgae fo user
            msg_user = MESSAGES.get('items_move_success', '')
        # ----------------------
        # Settings page as draft
        # ----------------------
        elif 'draft' in request.POST:
            page.draft = not page.draft
            page.save()
            refresh_manager = True
            msg_user = MESSAGES.get('page_draft_toggle', '') 
        # ----------------------
        # Updating settings page
        # ----------------------
        else:
            # Get POST values
            post_values = request.POST.copy()
            post_values['website'] = request.website.id
            # Creation of form
            form = PageWAForm(post_values, instance=page)
            if form.is_valid():
                page = form.save()
                # We ask content updating
                if page == request.page:
                    refresh_page = True
                # Message for user
                msg_user = MESSAGES.get('app_edit_success', '')
            else:
                # We reload the edit form with errors
                content = render_to_string('administration/page/page-edit.html',
                                           {'form': form, 
                                            'page': page},
                                           context_instance = RequestContext(request))
                response = Response(status.HTTP_203_NON_AUTHORITATIVE_INFORMATION,
                                    {"html": content,
                                     "msg": MESSAGES.get('default_error', "")})
                return self.render(response)
        # ---------------
        # Refresh Website
        # ---------------
        # Update cache for current page displayed.
        request.page = get_object_or_404(request.website.pages, pk=request.page.id)
        # Check if we need reload current page
        # if current url changed or refresh content asked.
        new_url_current_page = request.page.get_absolute_url()
        if old_url_current_page != new_url_current_page or refresh_page:
            response = Response(status.HTTP_202_ACCEPTED,
                                {'location': new_url_current_page})
            return self.render(response)
        # Else we refresh only page manager and navigation.
        # Page manager:
        if refresh_manager:
            pages_list = request.website.pages.all()
            page_manager_html = render_to_string('administration/page/page-list.html',
                                                 {'pages': pages_list,},
                                                 context_instance = RequestContext(request))
        else:
            page_manager_html = None

        navigation_html = RenderingContext(request).html_navigation
        # Response
        response = Response(status.HTTP_200_OK,
                            {"manager_html": page_manager_html,
                             "navigation_html": navigation_html,
                             # "page_html": page_content_html,
                             "msg": msg_user})
        return self.render(response)
Scan for processes and fire events
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/administration/views/page.py/PageView.post--crossover with--dataset/ETHPy150Open saltstack/salt/salt/beacons/ps.py/beacon