All ManyToMany field get a default message which is not overridable
|Reported by:||Anand Kumria||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
All ManyToManyFields get a default message in the help_text, which is not overridable.
The message is: 'Hold down "Control", or "Command" on a Mac, to select more than one.'
This is done in the file django/db/models/fields/related.py and it makes sense if the related field is being displayed as a select list.
However, if you display a many to many relation using the inbuilt CheckboxSelectMultiple widget - for example - the message actually makes no sense. It makes no sense because you will have multiple checkboxes which you can independently click on.
In fact, have a textual string referencing the likely output method in the model seems to be a layering violation.
Attached is a patch to put this text in only if there is no help_text provided. Since it will use the overridden help_text, people are free to add back in the initial text if required.
Change History (2)
Changed 5 years ago by