diff -r 4ab56ec63b95 django/contrib/admin/templates/admin/auth/user/add_form.html
a
|
b
|
|
2 | 2 | {% load i18n %} |
3 | 3 | |
4 | 4 | {% block form_top %} |
5 | | <p>{% trans "First, enter a username and password. Then, you'll be able to edit more user options." %}</p> |
| 5 | {% if not is_popup %} |
| 6 | <p>{% trans "First, enter an username and password. Then, you'll be able to edit more user options." %}</p> |
6 | 7 | <input type="hidden" name="_continue" value="1" /> |
| 8 | {% else %} |
| 9 | <p>{% trans "Enter an username and password." %}</p> |
| 10 | {% endif %} |
7 | 11 | {% endblock %} |
8 | 12 | |
9 | 13 | {% block after_field_sets %} |
diff -r 4ab56ec63b95 tests/regressiontests/admin_views/models.py
a
|
b
|
|
10 | 10 | from django.db import models |
11 | 11 | from django import forms |
12 | 12 | from django.forms.models import BaseModelFormSet |
| 13 | from django.contrib.auth.models import User |
13 | 14 | from django.contrib.contenttypes import generic |
14 | 15 | from django.contrib.contenttypes.models import ContentType |
15 | 16 | |
… |
… |
|
579 | 580 | class PizzaAdmin(admin.ModelAdmin): |
580 | 581 | readonly_fields = ('toppings',) |
581 | 582 | |
| 583 | class Album(models.Model): |
| 584 | owner = models.ForeignKey(User) |
| 585 | title = models.CharField(max_length=30) |
| 586 | |
582 | 587 | admin.site.register(Article, ArticleAdmin) |
583 | 588 | admin.site.register(CustomArticle, CustomArticleAdmin) |
584 | 589 | admin.site.register(Section, save_as=True, inlines=[ArticleInline]) |
… |
… |
|
625 | 630 | admin.site.register(ChapterXtra1) |
626 | 631 | admin.site.register(Pizza, PizzaAdmin) |
627 | 632 | admin.site.register(Topping) |
| 633 | admin.site.register(Album) |
diff -r 4ab56ec63b95 tests/regressiontests/admin_views/tests.py
a
|
b
|
|
2113 | 2113 | response = self.client.get('/test_admin/admin/admin_views/pizza/add/') |
2114 | 2114 | self.assertEqual(response.status_code, 200) |
2115 | 2115 | |
2116 | | class IncompleteFormTest(TestCase): |
| 2116 | class UserAdminTest(TestCase): |
2117 | 2117 | """ |
2118 | | Tests validation of a ModelForm that doesn't explicitly have all data |
2119 | | corresponding to model fields. Model validation shouldn't fail |
2120 | | such a forms. |
| 2118 | Tests user CRUD functionality. |
2121 | 2119 | """ |
2122 | 2120 | fixtures = ['admin-views-users.xml'] |
2123 | 2121 | |
… |
… |
|
2149 | 2147 | self.assert_('password' not in adminform.form.errors) |
2150 | 2148 | self.assertEquals(adminform.form.errors['password2'], |
2151 | 2149 | [u"The two password fields didn't match."]) |
| 2150 | |
| 2151 | def test_user_fk_popup(self): |
| 2152 | response = self.client.get('/test_admin/admin/admin_views/album/add/') |
| 2153 | self.failUnlessEqual(response.status_code, 200) |
| 2154 | self.assertContains(response, '/test_admin/admin/auth/user/add') |
| 2155 | self.assertContains(response, 'class="add-another" id="add_id_owner" onclick="return showAddAnotherPopup(this);"') |
| 2156 | response = self.client.get('/test_admin/admin/auth/user/add/?_popup=1') |
| 2157 | self.assertNotContains(response, 'name="_continue"') |