Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #14012 (again) -- Admin app: Don't show the full user edition v…

…iew after adding a user in a FK popup. Thanks dburke for reporting this regression introduced in r14628.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 12bd7bc commit 4b13e76debbb64818559b504a2dd043af5fcad33 @ramiro ramiro committed
9 django/contrib/auth/
@@ -142,9 +142,12 @@ def response_add(self, request, obj, post_url_continue='../%s/'):
its superclass implementation but is customized because the User model
has a slightly different workflow.
- if '_addanother' not in request.POST:
- # The 'Save' button should act like the 'Save and continue
- # editing' button
+ # We should allow further modification of the user just added i.e. the
+ # 'Save' button should behave like the 'Save and continue editing'
+ # button except in two scenarios:
+ # * The user has pressed the 'Save and add another' button
+ # * We are adding a user in a popup
+ if '_addanother' not in request.POST and '_popup' not in request.POST:
request.POST['_continue'] = 1
return super(UserAdmin, self).response_add(request, obj, post_url_continue)
12 tests/regressiontests/admin_views/
@@ -2637,13 +2637,25 @@ def test_password_mismatch(self):
[u"The two password fields didn't match."])
def test_user_fk_popup(self):
+ """Quick user addition in a FK popup shouldn't invoke view for further user customization"""
response = self.client.get('/test_admin/admin/admin_views/album/add/')
self.assertEqual(response.status_code, 200)
self.assertContains(response, '/test_admin/admin/auth/user/add')
self.assertContains(response, 'class="add-another" id="add_id_owner" onclick="return showAddAnotherPopup(this);"')
response = self.client.get('/test_admin/admin/auth/user/add/?_popup=1')
+ self.assertEqual(response.status_code, 200)
self.assertNotContains(response, 'name="_continue"')
self.assertNotContains(response, 'name="_addanother"')
+ data = {
+ 'username': 'newuser',
+ 'password1': 'newpassword',
+ 'password2': 'newpassword',
+ '_popup': '1',
+ '_save': '1',
+ }
+ response ='/test_admin/admin/auth/user/add/?_popup=1', data, follow=True)
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response, 'dismissAddAnotherPopup')
def test_save_add_another_button(self):
user_count = User.objects.count()

0 comments on commit 4b13e76

Please sign in to comment.
Something went wrong with that request. Please try again.