Code

Opened 7 years ago

Closed 4 years ago

Last modified 3 years ago

#6183 closed (fixed)

[patch] Support help_text with ManyToMany field widgets

Reported by: Steven Armstrong <sa@…> Owned by: acdha
Component: contrib.admin Version: 1.2
Severity: Keywords: sprintSep2010
Cc: chris@…, andrewbadr.etc@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently the help_text for ManyToMany fields is not showed in the admin if you use the nifty filter interfaces.

It is removed while generating the widget in SelectFilter2.js.

The attached patch fixes that by putting the help texts in a place where they don't interfere with the markup of the select filter widget.

Only tested in firefox. I don't have any other browser at hand atm.

Attachments (4)

newforms-admin_ManyToManyField-widget.patch (3.5 KB) - added by Steven Armstrong <sa@…> 7 years ago.
screenshot.png (28.6 KB) - added by Steven Armstrong <sa@…> 7 years ago.
django-6183.patch (2.8 KB) - added by acdha 5 years ago.
Updated patch for 1.1
django-6183-better.patch (1.1 KB) - added by acdha 5 years ago.
Much smaller patch, tested in Safari/IE/Firefox/Chrome

Download all attachments as: .zip

Change History (22)

Changed 7 years ago by Steven Armstrong <sa@…>

Changed 7 years ago by Steven Armstrong <sa@…>

comment:1 Changed 7 years ago by brosner

  • Keywords nfa-someday added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

This looks good and pretty trivial to get included. Test your patch on all browsers and patch up anything that breaks. However this isn't critical before merging to trunk. Tagging with nfa-someday.

comment:2 Changed 5 years ago by kit1980

  • Keywords nfa-someday removed

Newforms-admin merged to trunk long time ago.
Maybe someday is now? :-)

comment:3 Changed 5 years ago by lakinwecker

Yeah I'd be interested in getting this added to trunk too.

comment:4 Changed 5 years ago by kmtracey

#11452 and #6459 were closed as dupes of this.

Changed 5 years ago by acdha

Updated patch for 1.1

comment:5 Changed 5 years ago by acdha

  • Version changed from newforms-admin to 1.1

The attached patch is updated against 1.1 and changes the mechanics slightly: instead of appending the help_text to the bottom of the widget, it ensures that it will be the first element in the container, which doesn't interfere with the filter widgets.

comment:6 Changed 5 years ago by acdha

  • Cc chris@… added

Changed 5 years ago by acdha

Much smaller patch, tested in Safari/IE/Firefox/Chrome

comment:7 Changed 5 years ago by acdha

I've uploaded a much more concise version of this patch which behaves the same as django-6183.patch and doesn't require the change to related.py. Tested in Safari 4, Firefox 3.5, IE7 (don't have 6 or 8 handy) and Chrome 4. Can someone review the patch?

comment:8 Changed 4 years ago by mattjmorrison

I'm not sure if this is really a separate issue, but it seems related to this one... First off, why is there default help text in the ManyToManyField specific to a widget that COULD be used for that type of field? It seems like that "Hold down control..." wording really doesn't belong in a database level field class at all. Secondly, I'm sure this was added for a reason, but why is the help_text of a ManyToManyField not over-writable? Looking at the trunk, any specified help_text that I specify on my ManyToManyFields still has the "widget specific" wording appended to the end of it. In my case, I'd like to specify some help_text for a ManyToManyField and I also happen to be using my own custom widget for that same field. Since the "Hold down control..." wording doesn't make any sense for my custom widget, I should be able to override it with my own help_text.

IMHO, I think the real patch should remove the default help_text from the ManyToManyField class all together, and have that help_text added to the SelectMultiple widget instead.

Let me know if you think this should be a separate ticket/patch...

comment:9 Changed 4 years ago by acdha

  • Owner changed from nobody to acdha

comment:10 follow-up: Changed 4 years ago by acdha

  • Patch needs improvement unset
  • Version changed from 1.1 to 1.2

I think the larger question of where the help text comes from is definitely worth some changes but it's beyond the scope of this ticket.

Current patch here after testing:
http://github.com/acdha/django/compare/django-bug-6183

comment:11 in reply to: ↑ 10 Changed 4 years ago by acdha

Replying to acdha:

I think the larger question of where the help text comes from is definitely worth some changes but it's beyond the scope of this ticket.

Current patch here after testing:
http://github.com/acdha/django/compare/django-bug-6183

Direct patch link: http://github.com/acdha/django/compare/django-bug-6183.patch

comment:12 Changed 4 years ago by acdha

  • Keywords sprintSep2010 added

comment:13 Changed 4 years ago by andrewbadr

  • Cc andrewbadr.etc@… added

comment:14 Changed 4 years ago by ramiro

See also #14402.

comment:16 Changed 4 years ago by jezdez

  • Triage Stage changed from Accepted to Ready for checkin

comment:17 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

(In [15150]) Fixed #6183 -- Stopped hiding the help text for SelectFilter widgets. Thanks, acdha.

comment:18 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.