mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
Made m2m fields form help_text munging specific to admin widgets.
Refs #9321 and follow-up to e80de93af6.
This commit is contained in:
parent
e61d99d96d
commit
491419b5ff
2 changed files with 20 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
|
|||
from django.db.models import CharField, DateField
|
||||
from django.test import TestCase as DjangoTestCase
|
||||
from django.test import override_settings
|
||||
from django.utils import six
|
||||
from django.utils import translation
|
||||
|
||||
from . import models
|
||||
|
|
@ -168,6 +169,17 @@ class AdminFormfieldForDBFieldTests(TestCase):
|
|||
def testInheritance(self):
|
||||
self.assertFormfield(models.Album, 'backside_art', widgets.AdminFileWidget)
|
||||
|
||||
def test_m2m_widgets(self):
|
||||
"""m2m fields help text as it applies to admin app (#9321)."""
|
||||
class AdvisorAdmin(admin.ModelAdmin):
|
||||
filter_vertical = ['companies']
|
||||
|
||||
self.assertFormfield(models.Advisor, 'companies', widgets.FilteredSelectMultiple,
|
||||
filter_vertical=['companies'])
|
||||
ma = AdvisorAdmin(models.Advisor, admin.site)
|
||||
f = ma.formfield_for_dbfield(models.Advisor._meta.get_field('companies'), request=None)
|
||||
self.assertEqual(six.text_type(f.help_text), 'Hold down "Control", or "Command" on a Mac, to select more than one.')
|
||||
|
||||
|
||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
||||
class AdminFormfieldForDBFieldWithRequestTests(DjangoTestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue