diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-06 16:08:40 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-06 16:08:40 +0000 |
| commit | cefee67b7d531090b21a2b4457bb36fa5557d1f3 (patch) | |
| tree | 0d82c23cf98c9442b4c6e70d2b28264f7273fbf5 | |
| parent | 2ab3b52d2adb0aa6d15aa94e4fc5aab9ec3554d0 (diff) | |
Fixed #14014 -- Ensure that the "save and add another" button for users actually does what it says. Thanks to Ramiro for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13503 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/admin/templates/admin/auth/user/add_form.html | 1 | ||||
| -rw-r--r-- | tests/regressiontests/admin_views/tests.py | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/django/contrib/admin/templates/admin/auth/user/add_form.html b/django/contrib/admin/templates/admin/auth/user/add_form.html index 262089f4bf..c8889eb069 100644 --- a/django/contrib/admin/templates/admin/auth/user/add_form.html +++ b/django/contrib/admin/templates/admin/auth/user/add_form.html @@ -4,7 +4,6 @@ {% block form_top %} {% if not is_popup %} <p>{% trans "First, enter a username and password. Then, you'll be able to edit more user options." %}</p> - <input type="hidden" name="_continue" value="1" /> {% else %} <p>{% trans "Enter a username and password." %}</p> {% endif %} diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index badbfa4cab..41aade0561 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -2126,6 +2126,7 @@ class UserAdminTest(TestCase): self.client.logout() def test_user_creation(self): + user_count = User.objects.count() response = self.client.post('/test_admin/admin/auth/user/add/', { 'username': 'newuser', 'password1': 'newpassword', @@ -2134,6 +2135,7 @@ class UserAdminTest(TestCase): }) new_user = User.objects.order_by('-id')[0] self.assertRedirects(response, '/test_admin/admin/auth/user/%s/' % new_user.pk) + self.assertEquals(User.objects.count(), user_count + 1) self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD) def test_password_mismatch(self): @@ -2155,3 +2157,16 @@ class UserAdminTest(TestCase): 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.assertNotContains(response, 'name="_continue"') + + def test_user_add_another(self): + user_count = User.objects.count() + response = self.client.post('/test_admin/admin/auth/user/add/', { + 'username': 'newuser', + 'password1': 'newpassword', + 'password2': 'newpassword', + '_addanother': '1', + }) + new_user = User.objects.order_by('-id')[0] + self.assertRedirects(response, '/test_admin/admin/auth/user/add/') + self.assertEquals(User.objects.count(), user_count + 1) + self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD) |
