Thursday, December 4, 2014

How to set choice limit of given number on ModelMultipleChoiceField in Django?

Hi there, I got a following Form-Class:


class CustomUserprofileInterestsForm(forms.ModelForm):

    interests = forms.ModelMultipleChoiceField(
        queryset=Interests.objects.all(),
        widget=forms.CheckboxSelectMultiple)


I want to limit the choices for example to 6 of all displayed.
Is it possible with some optional arguments I don't know somehow?

Best regards.. cheers!

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/56b7cccc-f23a-4ee4-96b5-d3e919ecf467%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment