Opened 15 years ago

Closed 14 years ago

#12359 closed (duplicate)

db/models/fields/related.py hardcodes m2m help_text for select widget

Reported by: Ole Laursen Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There's a bit of code in the many to many field definition that appends some help for the standard usability-troubled HTML select widget to the help_text:

  msg = ugettext_lazy('Hold down "Control", or "Command" on a Mac, to select more than one.')
  self.help_text = string_concat(self.help_text, ' ', msg)

This means that if you define a custom help_text, you have to take care to someone de-append the help_text when overwriting the widget for a form, e.g. when using the built-in CheckboxSelectMultiple widget instead of a plain select box.

Practical issues aside, it's also probably not a good idea to hardcode the help_text for a particular presentational widget in the db layer, had to grep the whole codebase to find it. :)

I suggest the text be moved to the SelectMultiple widget in the forms code.

Attachments (1)

help_text_r12827.diff (2.2 KB ) - added by trey@… 15 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by trey@…, 15 years ago

Has patch: set

This assumption should probably not be made at all. I think the django admin (which is why this was added I'm sure) should store this in a constant somewhere and append it when it needs it like any app that's created by a django user would need to do.

by trey@…, 15 years ago

Attachment: help_text_r12827.diff added

comment:3 by crucialfelix@…, 14 years ago

+1 : its not the domain of the database field

but trey says above that it should be the admin that does it. IMO it should be the widget that adds advice as to how to operate its own widget. it should never be assumed that the admin is present

comment:4 by Karen Tracey, 14 years ago

Resolution: duplicate
Status: newclosed

This is already reported in #9321.

Note: See TracTickets for help on using tickets.
Back to Top