1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

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
This commit is contained in:
Adrian Holovaty 2007-04-07 02:26:45 +00:00
parent 94aeccf18e
commit d7ed268dc5

View File

@ -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):