Fixed #14402 -- Removed clearing of help_text for ManyToManyField's raw_id_fields.

This commit is contained in:
Alexander Gaevsky 2016-01-29 23:21:21 +02:00 committed by Tim Graham
parent 9644e2e968
commit c79852acee
3 changed files with 12 additions and 2 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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()