From c79852acee9a2ca137ff0e19657342c7406bbbb9 Mon Sep 17 00:00:00 2001 From: Alexander Gaevsky Date: Fri, 29 Jan 2016 23:21:21 +0200 Subject: [PATCH] Fixed #14402 -- Removed clearing of help_text for ManyToManyField's raw_id_fields. --- django/contrib/admin/options.py | 1 - tests/admin_widgets/models.py | 7 ++++++- tests/admin_widgets/tests.py | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index db1e877a74..1bf2709dc0 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -242,7 +242,6 @@ class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)): if db_field.name in self.raw_id_fields: kwargs['widget'] = widgets.ManyToManyRawIdWidget(db_field.remote_field, self.admin_site, using=db) - kwargs['help_text'] = '' elif db_field.name in (list(self.filter_vertical) + list(self.filter_horizontal)): kwargs['widget'] = widgets.FilteredSelectMultiple( db_field.verbose_name, diff --git a/tests/admin_widgets/models.py b/tests/admin_widgets/models.py index d795fea007..274c36e15e 100644 --- a/tests/admin_widgets/models.py +++ b/tests/admin_widgets/models.py @@ -68,7 +68,12 @@ class Event(models.Model): limit_choices_to=models.Q(pk__gt=0), related_name='events_main_band_at', ) - supporting_bands = models.ManyToManyField(Band, blank=True, related_name='events_supporting_band_at') + supporting_bands = models.ManyToManyField( + Band, + blank=True, + related_name='events_supporting_band_at', + help_text='Supporting Bands.', + ) start_date = models.DateField(blank=True, null=True) start_time = models.TimeField(blank=True, null=True) description = models.TextField(blank=True) diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index cbaeaa8353..00f0f31b68 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -1255,6 +1255,12 @@ class AdminRawIdWidgetSeleniumFirefoxTests(SeleniumDataMixin, AdminSeleniumWebDr self.selenium.find_element_by_id('id_supporting_bands').get_attribute('value'), '') + # Help text for the field is displayed + self.assertEqual( + self.selenium.find_element_by_css_selector('.field-supporting_bands p.help').text, + 'Supporting Bands.' + ) + # Open the popup window and click on a band self.selenium.find_element_by_id('lookup_id_supporting_bands').click() self.wait_for_popup()