summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-04-07 02:26:45 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-04-07 02:26:45 +0000
commitd7ed268dc5ab977f3c90b303ae6e8eb19f1662f4 (patch)
tree504e98b4f842373b14f6b76fb31dafb9e05b68cc
parent94aeccf18eca83ce8c983695059d56f66127a0fd (diff)
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
-rw-r--r--django/contrib/admin/options.py7
1 files changed, 7 insertions, 0 deletions
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):