Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #14012 -- Corrected the handling of the create user popup dialo…

…g in the admin. Thanks to gk@lka.hu for the report, and Ramiro Morales for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13501 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2ab3b52d2adb0aa6d15aa94e4fc5aab9ec3554d0 1 parent f90a255
@freakboy3742 freakboy3742 authored
View
4 django/contrib/admin/templates/admin/auth/user/add_form.html
@@ -2,8 +2,12 @@
{% load i18n %}
{% 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 %}
{% endblock %}
{% block after_field_sets %}
View
6 tests/regressiontests/admin_views/models.py
@@ -10,6 +10,7 @@
from django.db import models
from django import forms
from django.forms.models import BaseModelFormSet
+from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
@@ -579,6 +580,10 @@ class Pizza(models.Model):
class PizzaAdmin(admin.ModelAdmin):
readonly_fields = ('toppings',)
+class Album(models.Model):
+ owner = models.ForeignKey(User)
+ title = models.CharField(max_length=30)
+
admin.site.register(Article, ArticleAdmin)
admin.site.register(CustomArticle, CustomArticleAdmin)
admin.site.register(Section, save_as=True, inlines=[ArticleInline])
@@ -625,3 +630,4 @@ class PizzaAdmin(admin.ModelAdmin):
admin.site.register(ChapterXtra1)
admin.site.register(Pizza, PizzaAdmin)
admin.site.register(Topping)
+admin.site.register(Album)
View
14 tests/regressiontests/admin_views/tests.py
@@ -2113,11 +2113,9 @@ def test_readonly_manytomany(self):
response = self.client.get('/test_admin/admin/admin_views/pizza/add/')
self.assertEqual(response.status_code, 200)
-class IncompleteFormTest(TestCase):
+class UserAdminTest(TestCase):
"""
- Tests validation of a ModelForm that doesn't explicitly have all data
- corresponding to model fields. Model validation shouldn't fail
- such a forms.
+ Tests user CRUD functionality.
"""
fixtures = ['admin-views-users.xml']
@@ -2149,3 +2147,11 @@ def test_password_mismatch(self):
self.assert_('password' not in adminform.form.errors)
self.assertEquals(adminform.form.errors['password2'],
[u"The two password fields didn't match."])
+
+ def test_user_fk_popup(self):
+ response = self.client.get('/test_admin/admin/admin_views/album/add/')
+ self.failUnlessEqual(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.assertNotContains(response, 'name="_continue"')
Please sign in to comment.
Something went wrong with that request. Please try again.