Hi Dexter, thanks for your answer, The urls you gave are about forms, not formsets? My code looks like this:
---- @teacher_required def add_students(request): school = School.objects.for_user(request.user) class StudentForm(UserCreationForm): name = forms.CharField(label='Naam') group = forms.ChoiceField(label='Groep') def __init__(self, *args, **kwargs): super(StudentForm, self).__init__(*args, **kwargs) self.fields['group'].choices = [(g.id, g.name) for g in StudentGroup.objects.for_school(school)] from django.forms.formsets import formset_factory StudentFormSet = formset_factory(StudentForm, extra=10) if request.method == 'POST': formset = StudentFormSet(request.POST) if formset.is_valid(): for form in formset: if form.is_valid(): user = form.save() student = Student(user=user, name=form.cleaned_data['name'], group_id=form.cleaned_data['group']) student.save() return HttpResponseRedirect(reverse('schooladmin_students')) else: #GET formset = StudentFormSet() base_template = get_base_template(request.user) return render_to_response('school/add_students.html', { 'formset': formset, 'base_template': base_template }, context_instance=RequestContext(request)) --- The StudentForm is defined over here because I could not set the groups otherwise. I am using Django 1.0 . After the post, I'd like to ignore empty forms in the formset. Is this possible? Best regards, groeten van Wim On 15 mei, 20:31, Dexter <a.essel...@gmail.com> wrote: > Hey, > > Ik zou deze pagina even > bekijken:http://docs.djangoproject.com/en/1.1/ref/forms/validation/#ref-forms-... > > <http://docs.djangoproject.com/en/1.1/ref/forms/validation/#ref-forms-...> > Grtz > > > > > > On Sat, May 15, 2010 at 7:34 PM, Wim Feijen <wimfei...@gmail.com> wrote: > > Hi all, > > > Can some of you please help me with the following? > > > For an application, I need to display the same form ten times over. > > Filling in each form is optional. Of course, I'd like to keep this > > safe & simple and therefore I am looking at formsets. > > > Is it possible to use a formset, call formset.is_valid() and that it > > ignores empty forms? > > > I'm using the forms only for adding new data, not for altering > > existing data. > > > Thanks! > > > Best regards, Wim > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@google > > groups.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-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://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-us...@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.