重定向在管理员保存 [英] Redirect on admin Save

查看:108
本文介绍了重定向在管理员保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ p

我有两个应用程序,例如 app1 app2 。如果用户点击 app2 中的保存,则应将其重定向到 app1 ,而不是默认页面。



我不想做一个customform。

解决方案

def change_view自我,请求,object_id,extra_context =无):

  result = super(mymodeladmin,self).change_view(request,object_id, 

result ['Location'] =你的位置

返回结果


How can I redirect a user to different app on Save?

I have two app, say app1 and app2. If a user clicks on Save in app2 then it should be redirected to app1 rather then the default page.

I don't want to do a customform.

解决方案

def change_view(self, request, object_id,extra_context=None):

result = super(mymodeladmin, self).change_view(request, object_id, extra_context)

result['Location'] = "your location"

return result

这篇关于重定向在管理员保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆