Wednesday, July 25, 2012

Re: Variable # of fields in a form

It seems to me that two fields might be the simple solution?

class SomeForm(Form):
internal = forms.ModelMultipleChoiceField(
<get internal qs>,
widget=forms.CheckboxSelectMultiple)
externa = forms.ModelMultipleChoiceField(
<get external qs>,
widget=forms.CheckboxSelectMultiple)


Then you can just output them in your layout {{form.internal}} and
{{form.external}}

Another thing that might be of interest to you is crispy forms:
https://github.com/maraujop/django-crispy-forms/

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment