From d7ed268dc5ab977f3c90b303ae6e8eb19f1662f4 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 7 Apr 2007 02:26:45 +0000 Subject: [PATCH] newforms-admin: Fixed bug in ModelAdmin.save_add() git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4941 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/options.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 88b91cc417..a7d04538fd 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -322,6 +322,13 @@ class ModelAdmin(object): return HttpResponseRedirect(request.path) else: request.user.message_set.create(message=msg) + # Figure out where to redirect. If the user has change permission, + # redirect to the change-list page for this object. Otherwise, + # redirect to the admin index. + if self.has_change_permission(request, None): + post_url = '../' + else: + post_url = '../../../' return HttpResponseRedirect(post_url) def save_change(self, request, model, form):