Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #14014 -- Ensure that the "save and add another" button…

… for users actually does what it says. Thanks to Ramiro for the report.

Backport of r13503 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c543f079ffd2b3dd76729188981f0dabb1c3d66a 1 parent 7930d8c
Russell Keith-Magee authored August 06, 2010
1  django/contrib/admin/templates/admin/auth/user/add_form.html
@@ -4,7 +4,6 @@
4 4
 {% block form_top %}
5 5
   {% if not is_popup %}
6 6
     <p>{% trans "First, enter a username and password. Then, you'll be able to edit more user options." %}</p>
7  
-    <input type="hidden" name="_continue" value="1" />
8 7
   {% else %}
9 8
     <p>{% trans "Enter a username and password." %}</p>
10 9
   {% endif %}
15  tests/regressiontests/admin_views/tests.py
@@ -2126,6 +2126,7 @@ def tearDown(self):
2126 2126
         self.client.logout()
2127 2127
 
2128 2128
     def test_user_creation(self):
  2129
+        user_count = User.objects.count()
2129 2130
         response = self.client.post('/test_admin/admin/auth/user/add/', {
2130 2131
             'username': 'newuser',
2131 2132
             'password1': 'newpassword',
@@ -2134,6 +2135,7 @@ def test_user_creation(self):
2134 2135
         })
2135 2136
         new_user = User.objects.order_by('-id')[0]
2136 2137
         self.assertRedirects(response, '/test_admin/admin/auth/user/%s/' % new_user.pk)
  2138
+        self.assertEquals(User.objects.count(), user_count + 1)
2137 2139
         self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)
2138 2140
 
2139 2141
     def test_password_mismatch(self):
@@ -2155,3 +2157,16 @@ def test_user_fk_popup(self):
2155 2157
         self.assertContains(response, 'class="add-another" id="add_id_owner" onclick="return showAddAnotherPopup(this);"')
2156 2158
         response = self.client.get('/test_admin/admin/auth/user/add/?_popup=1')
2157 2159
         self.assertNotContains(response, 'name="_continue"')
  2160
+
  2161
+    def test_user_add_another(self):
  2162
+        user_count = User.objects.count()
  2163
+        response = self.client.post('/test_admin/admin/auth/user/add/', {
  2164
+            'username': 'newuser',
  2165
+            'password1': 'newpassword',
  2166
+            'password2': 'newpassword',
  2167
+            '_addanother': '1',
  2168
+        })
  2169
+        new_user = User.objects.order_by('-id')[0]
  2170
+        self.assertRedirects(response, '/test_admin/admin/auth/user/add/')
  2171
+        self.assertEquals(User.objects.count(), user_count + 1)
  2172
+        self.assertNotEquals(new_user.password, UNUSABLE_PASSWORD)

0 notes on commit c543f07

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