diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2013-05-19 16:28:33 -0300 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2014-03-22 15:43:17 -0300 |
| commit | 491419b5ffac3752a1c1804a763c017a2ed82e16 (patch) | |
| tree | e08845ec21ea6f0db8ca35558c596625418f9135 /tests/admin_widgets/tests.py | |
| parent | e61d99d96daedfea2f6ba071945ef0d2f86883c7 (diff) | |
Made m2m fields form help_text munging specific to admin widgets.
Refs #9321 and follow-up to e80de93af6a0a21a9063a55c4d6d20e3927243e9.
Diffstat (limited to 'tests/admin_widgets/tests.py')
| -rw-r--r-- | tests/admin_widgets/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 939fb65a04..86fb611f00 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -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): |
