def post(self, request):
        """
        Update a PluginRelation.

        Parameters :
          - placeholder_id : HTML ID of the new placeholder, eg "content-placeholder-1"
          - plugins_order[] : Ordered list of plugins HTML IDs in the new placeholder
        """
        
        placeholder_html_id = request.POST.get('placeholder_id', None)
        plugins_order  = request.POST.getlist('plugins_order[]')

        if placeholder_html_id and plugins_order:

            # Check placeholder HTML ID
            check_placeholder_html_id(placeholder_html_id,
                                      extras_id=[settings.HTML_ID_PLACEHOLDER_CLIPBOARD,])

            i = 0
            for plugin_id in plugins_order:                
                # Check plugin HTML ID
                plugin_type, relation_id = check_object_html_id(plugin_id,
                                                           types=[settings.SLUG_PLUGIN,
                                                                  settings.SLUG_APP])

                # Be careful, can be a Page object or a relation object
                # In case you are moving the app and not a plugin
                if plugin_type == settings.SLUG_APP:
                    if placeholder_html_id == settings.HTML_ID_PLACEHOLDER_CLIPBOARD:
                        raise ErrorResponse(status.HTTP_400_BAD_REQUEST,
                                            {'msg': MESSAGES.get('default_error', "")})
                    # Get page object to manage app order
                    obj = request.page
                # Plugin object
                else:
                    try:
                        obj = PluginRelation.objects.filter(pages__website__exact=request.website, 
                                                            id__exact=relation_id)[0]

                        # 1. This new placeholder_html_id is website placeholder
                        #      - Add all pages
                        #      - Activate auto creation on new pages
                        if not (is_page_placeholder_html_id(placeholder_html_id) or 
                                placeholder_html_id == settings.HTML_ID_PLACEHOLDER_CLIPBOARD):
                            obj.pages.add(*request.website.pages.all())
                            if not obj.display_on_new_pages:
                                obj.display_on_new_pages = True
                                obj.save()

                        else:
                        # 2. This new placeholder_html_id is page placeholder
                        #      - Delete all pages
                        #      - Add current pages
                        #      - Deactivate auto creation in new page
                            obj.pages.clear()
                            obj.pages.add(request.page)
                            if obj.display_on_new_pages:
                                obj.display_on_new_pages = False
                                obj.save()
                    except IndexError:
                        raise ErrorResponse(status.HTTP_400_BAD_REQUEST,
                                            {'msg': MESSAGES.get('default_error', "")})
                # Update order
                obj.plugin_order = i
                if plugin_type == settings.SLUG_APP:
                    if i > 5:
                        obj.plugin_order -= 5
                else:
                    i = i + 10
                # Update placeholder slug
                obj.placeholder_slug = placeholder_html_id
                obj.save()
            # Send a 200 Response
            response = Response(status.HTTP_200_OK,
                                {"msg": MESSAGES.get('items_move_success', '')})
            return self.render(response)

        # Bad parameters => 400 BAR REQUEST
        else:
            raise ErrorResponse(status.HTTP_400_BAD_REQUEST,
                                {'msg': MESSAGES.get('default_error', "")})
dataset/ETHPy150Open ionyse/ionyweb/ionyweb/administration/views/plugin.py/PluginRelationView.post/original