ups, forgot to add forms.py
This commit is contained in:
parent
323aa6a686
commit
98d270017c
17
itf/itfcore/forms.py
Normal file
17
itf/itfcore/forms.py
Normal file
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user