2013-09-22 35 views
0

我有一个Django的形式,其为的ModelForm:的Django的ModelForm FORMSET第一种形式需要

class EducationForm(ModelForm): 
    class Meta: 
     model = Education 

但它实际上是作为一个formset:

queryset_education = Education.objects.filter(member = edit_member) 
EducationFormSet = modelformset_factory(Education, form = EducationForm) 
form_education = EducationFormSet(queryset = queryset_education) 

我怎样才能迫使第一形式需要? 我在StackOverflow中看到了一些类似的问题...没有人帮助我,因为我没有从BaseFormSet继承的类(我应该创建一个吗?)

谢谢!

Tidhar

回答

1

是的,你应该定义一个formset类与clean方法,并通过在作为formset参数modelformset_factory

+0

这正是我现在正在尝试... – TidharPeer

相关问题