Пример #1
0
            def wrapped(request, obj, button):
                """We want to redirect back to the form regardless of what the view does"""
                # Do the normal view
                func(request, obj, button)

                # Find where to redirect to and go there
                if button.for_all:
                    url = AdminView.change_list(self.model)
                else:
                    url = AdminView.change_view(obj)
                return renderer.redirect(request, url, no_processing=True)
Пример #2
0
            def wrapped(request, obj, button):
                """We want to redirect back to the form regardless of what the view does"""
                # Do the normal view
                func(request, obj, button)

                # Find where to redirect to and go there
                if button.for_all:
                    url = AdminView.change_list(self.model)
                else:
                    url = AdminView.change_view(obj)
                return renderer.redirect(request, url, no_processing=True)
Пример #3
0
    def response_change(self, request, obj):
        """
            Change response to a change
            Redirects to a button if it has been set as a POST item
        """
        redirect = None
        for key in request.POST.keys():
            if key.startswith("tool_"):
                redirect = key

        if redirect:
            return renderer.redirect(request, redirect, no_processing=True)
        else:
            return super(ButtonAdmin, self).response_change(request, obj)
Пример #4
0
    def response_change(self, request, obj):
        """
            Change response to a change
            Redirects to a button if it has been set as a POST item
        """
        redirect = None
        for key in request.POST.keys():
            if key.startswith("tool_"):
                redirect = key

        if redirect:
            return renderer.redirect(request, redirect, no_processing=True)
        else:
            return super(ButtonAdmin, self).response_change(request, obj)