Fixed #8433 -- Deal with the add user popup on models that foreign key to User correctly. Thanks sorl for the report and fix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8776 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner 2008-08-31 21:24:33 +00:00
parent d511996901
commit ab13303ea4
1 changed files with 2 additions and 0 deletions

View File

@ -53,6 +53,8 @@ class UserAdmin(admin.ModelAdmin):
if "_addanother" in request.POST: if "_addanother" in request.POST:
request.user.message_set.create(message=msg) request.user.message_set.create(message=msg)
return HttpResponseRedirect(request.path) return HttpResponseRedirect(request.path)
elif '_popup' in request.REQUEST:
return self.response_add(request, new_user)
else: else:
request.user.message_set.create(message=msg + ' ' + ugettext("You may edit it again below.")) request.user.message_set.create(message=msg + ' ' + ugettext("You may edit it again below."))
return HttpResponseRedirect('../%s/' % new_user.id) return HttpResponseRedirect('../%s/' % new_user.id)