How bad of an Idea is it to not use Django forms? I feel like Django forms are kinda a pain
On Fri, Feb 4, 2011 at 12:06 PM, Tom Evans <tevans...@googlemail.com> wrote: > On Fri, Feb 4, 2011 at 4:20 PM, Shawn Milochik <sh...@milochik.com> wrote: > > Here's the main piece: > > http://docs.djangoproject.com/en/1.2/ref/forms/ > > Just make a form with a boolean field. > > When you've successfully made one form that you submit, validate, and act > > upon, just throw a bunch in a formset: > > http://docs.djangoproject.com/en/1.2/topics/forms/formsets/ > > If you get stuck along the way, paste the full error messages and sample > > code. > > Shawn > > > > If the fields are semanticly related, then that advice makes a lot of > sense. However if they are disparate options, and the only thing that > relates them is that they are boolean options, then it may be easier > to do this as a single form, with a ChoiceField that uses a > CheckboxSelectMultiple widget: > > QUESTIONS = ( > ( 'cheese', 'Do you like cheese?' ), > ( 'meat', 'Do you eat meat?' ), > ( 'stupid', 'Do you like inane questions?' ), > ) > > class QuestionnaireForm(forms.Form): > questions = forms.MultipleChoiceField(choices=QUESTIONS, > required=False, > label='Please answer these questions', > widget=forms.CheckboxSelectMultiple(),) > > Cheers > > Tom > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.