Hello, I am trying to create a complex form similar to the poll example. My create method is very similar to the following:
def create(request): if request.method == 'GET': pollform = bforms.PollForm() choiceforms = [] for i in range(4): choiceforms.append(bforms.ChoiceForm(prefix = 'f%s'%i)) if request.method == 'POST': pollform = bforms.PollForm(request.POST) choiceform = bforms.ChoiceForm() if pollform.is_valid(): poll = pollform.save() choiceforms = [] for i in range(4): choiceforms.append(bforms.ChoiceForm(poll=poll, prefix = 'f%s'%i, data=request.POST)) for form in choiceforms: if form.is_valid(): form.save() return HttpResponseRedirect(poll.get_absolute_url()) payload = dict(pollform=pollform, choiceforms=choiceforms) return render('create.html', payload) This method displays my form correctly, but when I try to save filling out only 1 of the 4 Choices, I get a required validation error. Is there a way to save only the number of choices I want to save between 1 and 4? Regards, Steven H. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---