当前位置: 动力学知识库 > 问答 > 编程问答 >

django - Issue with change_view save redirect

问题描述:

I am attempting to change the redirected for the django admin save button. What I pasted below works on saving an already existing entry (updating) but not on saving a new one. Any thoughts?

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

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

if not request.POST.has_key('_addanother') and not request.POST.has_key('_continue'):

result['Location'] = "/"

return result

网友答案:

I think you will have to modify add_view the same way you did change_view, unless i am not understanding the question correctly.

分享给朋友:
您可能感兴趣的文章:
随机阅读: