Ticket #14012: 14012.diff

File 14012.diff, 3.1 KB (added by Ramiro Morales, 14 years ago)

Patch for this issue

  • django/contrib/admin/templates/admin/auth/user/add_form.html

    diff -r 4ab56ec63b95 django/contrib/admin/templates/admin/auth/user/add_form.html
    a b  
    22{% load i18n %}
    33
    44{% block form_top %}
     5  {% if not is_popup %}
    56    <p>{% trans "First, enter a username and password. Then, you'll be able to edit more user options." %}</p>
    67    <input type="hidden" name="_continue" value="1" />
     8  {% else %}
     9    <p>{% trans "Enter a username and password." %}</p>
     10  {% endif %}
    711{% endblock %}
    812
    913{% block after_field_sets %}
  • tests/regressiontests/admin_views/models.py

    diff -r 4ab56ec63b95 tests/regressiontests/admin_views/models.py
    a b  
    1010from django.db import models
    1111from django import forms
    1212from django.forms.models import BaseModelFormSet
     13from django.contrib.auth.models import User
    1314from django.contrib.contenttypes import generic
    1415from django.contrib.contenttypes.models import ContentType
    1516
     
    579580class PizzaAdmin(admin.ModelAdmin):
    580581    readonly_fields = ('toppings',)
    581582
     583class Album(models.Model):
     584    owner = models.ForeignKey(User)
     585    title = models.CharField(max_length=30)
     586
    582587admin.site.register(Article, ArticleAdmin)
    583588admin.site.register(CustomArticle, CustomArticleAdmin)
    584589admin.site.register(Section, save_as=True, inlines=[ArticleInline])
     
    625630admin.site.register(ChapterXtra1)
    626631admin.site.register(Pizza, PizzaAdmin)
    627632admin.site.register(Topping)
     633admin.site.register(Album)
  • tests/regressiontests/admin_views/tests.py

    diff -r 4ab56ec63b95 tests/regressiontests/admin_views/tests.py
    a b  
    21132113        response = self.client.get('/test_admin/admin/admin_views/pizza/add/')
    21142114        self.assertEqual(response.status_code, 200)
    21152115
    2116 class IncompleteFormTest(TestCase):
     2116class UserAdminTest(TestCase):
    21172117    """
    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.
    21212119    """
    21222120    fixtures = ['admin-views-users.xml']
    21232121
     
    21492147        self.assert_('password' not in adminform.form.errors)
    21502148        self.assertEquals(adminform.form.errors['password2'],
    21512149                          [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"')
Back to Top