【Django Admin】点击保存后,重定向到当前模块下

    # 保存后 重定向跳转
    def change_view(self, request, object_id, form_url='', extra_context=None):
        result_template = super().change_view(request, object_id, form_url, extra_context)
        # result_template['location'] = '/admin'
        result_template['location'] = '/admin/#order/innerorder/' # 这里要加上#号
        return result_template

 

posted @ 2022-09-23 17:28  PythonNew_Mr.Wang  Views(84)  Comments(0)    收藏  举报