Checkboxes collection instead of a multiple select

67 views
Skip to first unread message

Jonathan Querubina

unread,
Feb 6, 2014, 6:15:16 AM2/6/14
to django...@googlegroups.com
Hi guys,

How do i show a collection of checkboxes instead of a multiple select?

Thanks!

Tom Evans

unread,
Feb 6, 2014, 9:48:16 AM2/6/14
to django...@googlegroups.com
Sounds like you want to change the widget on a form:

https://docs.djangoproject.com/en/1.6/ref/forms/widgets/

Specifically, changing it from a SelectMultiple widget to a
CheckboxSelectMultiple:

https://docs.djangoproject.com/en/1.6/ref/forms/widgets/#checkboxselectmultiple

Cheers

Tom

Jonathan Querubina

unread,
Feb 12, 2014, 6:56:25 AM2/12/14
to django...@googlegroups.com
Tom,

Thanks for the feedback!

This can be used on the admin form?
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1%2B7xxQYugLU8M%3DBq58pbfyZhF1WAHa31NpJr1xDsxcKgQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Tom Evans

unread,
Feb 12, 2014, 7:06:18 AM2/12/14
to django...@googlegroups.com
On Wed, Feb 12, 2014 at 11:56 AM, Jonathan Querubina
<john.c...@gmail.com> wrote:
> Tom,
>
> Thanks for the feedback!
>
> This can be used on the admin form?
>

Absolutely, simply override the widget for that specific field when
you register your ModelAdmin for that model:

https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_overrides

Cheers

Tom
Reply all
Reply to author
Forward
0 new messages