Reputation: 3797
I have a Django form which is a modelForm:
class EducationForm(ModelForm):
class Meta:
model = Education
But it is actually used as a formset:
queryset_education = Education.objects.filter(member = edit_member)
EducationFormSet = modelformset_factory(Education, form = EducationForm)
form_education = EducationFormSet(queryset = queryset_education)
How can I force the first form to be required? I saw some similar questions in StackOverflow... none helped me, as I don't have a class that inherit from BaseFormSet (Should I create one?)
Thanks!
Tidhar
Upvotes: 0
Views: 181
Reputation: 599778
Yes, you should define a formset class with a clean
method, and pass that in as the formset
argument to modelformset_factory
.
Upvotes: 1