On Jun 25, 1:03 pm, larry <[EMAIL PROTECTED]> wrote:

> I've derived a new version of the CheckboxSelectMultiple widget.
> Unfortunately, just like its parent, it prints a message "Hold down
> "Control", or "Command" on a Mac, to select more than one."  on each
> field.  This instruction, which I assume is coming from an ancestor
> class, is not appropriate for checkbox multiples.
>
> Any hint on how I can suppress it in my descendant?

The string you're referring to is appended to the help_text of a
ManyToManyField in django.db.models.fields.related.  It's not being
set by newforms, merely inherited.  You also wouldn't be seeing it if
you were using CheckboxSelectMultiple, only if the normal HTML select
widget were being used.

The only case that I'm aware of where this comes up is using the
form_for_* shortcuts.  To remove the string, one option is to define
your own form class.  For example:

class MyForm(Form):
    categories = ModelMultipleChoiceField(Category.objects.all())

If you wish to continue using the form_for_* shortcuts, you'll need to
modify the form class before instantiating it.  This may be a little
uglier, but something like:

klass = form_for_model(MyModel)
klass.base_fields['categories'].help_text = ''

would do the trick, with the caveat that any other help text the model
field may have specified gets erased too.

Matt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to