itf/itf/itfcore/forms.py
2011-10-08 03:03:05 -04:00

18 lines
615 B
Python
Executable File

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')