From 98d270017cd59ea0688dd1b4a8d8eedac490d9ea Mon Sep 17 00:00:00 2001 From: sanj Date: Thu, 21 Oct 2010 18:56:21 +0200 Subject: [PATCH] ups, forgot to add forms.py --- itf/itfcore/forms.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 itf/itfcore/forms.py diff --git a/itf/itfcore/forms.py b/itf/itfcore/forms.py new file mode 100644 index 0000000..e4d1908 --- /dev/null +++ b/itf/itfcore/forms.py @@ -0,0 +1,17 @@ +from django import forms +from models import * +from django.forms.models import modelformset_factory, inlineformset_factory + +#Inlines for Person Form +ConnectionFormset = inlineformset_factory(Person, PersonPerson, fk_name='person1') +ProductionFormset = inlineformset_factory(Person, PersonProduction) + + +#Actual person form definition +class PersonForm(forms.ModelForm): + occupations = forms.ModelMultipleChoiceField(Occupation.objects.all(), widget=forms.CheckboxSelectMultiple()) + inlines = [ConnectionFormset, ProductionFormset] + class Meta: + model = Person + exclude = ('connections', 'productions') +