Production form inline for people and widget for Script
This commit is contained in:
parent
d1863752ce
commit
75ec1aa0cc
|
@ -11,7 +11,7 @@ from django.contrib.contenttypes.models import ContentType
|
||||||
from app.forms import *
|
from app.forms import *
|
||||||
from imagestore.forms import AlbumForm, ImageForm
|
from imagestore.forms import AlbumForm, ImageForm
|
||||||
from itfprofiles.models import *
|
from itfprofiles.models import *
|
||||||
|
from scriptbank.models import Script
|
||||||
#Forms and Inlines for Generic Classes
|
#Forms and Inlines for Generic Classes
|
||||||
|
|
||||||
#class AlbumInlineForm(ItfForm, AlbumForm):
|
#class AlbumInlineForm(ItfForm, AlbumForm):
|
||||||
|
@ -152,14 +152,14 @@ class GroupOccupationForm(ItfForm):
|
||||||
model = GroupGroupOccupation
|
model = GroupGroupOccupation
|
||||||
|
|
||||||
|
|
||||||
PersonsInline = itf_inlineformset_factory(TheatreGroup, PersonGroup, form=GroupPersonForm, title="People in the Group")
|
PersonGroupInline = itf_inlineformset_factory(TheatreGroup, PersonGroup, form=GroupPersonForm, title="People in the Group")
|
||||||
|
|
||||||
GroupOccupationsInline = itf_inlineformset_factory(TheatreGroup, GroupGroupOccupation, form=GroupOccupationForm, title="Nature of work for the group")
|
GroupOccupationInline = itf_inlineformset_factory(TheatreGroup, GroupGroupOccupation, form=GroupOccupationForm, title="Nature of work for the group")
|
||||||
|
|
||||||
|
|
||||||
class TheatreGroupForm(ItfForm):
|
class TheatreGroupForm(ItfForm):
|
||||||
languages = forms.ModelMultipleChoiceField(Language.objects.all(), widget=forms.CheckboxSelectMultiple())
|
languages = forms.ModelMultipleChoiceField(Language.objects.all(), widget=forms.CheckboxSelectMultiple())
|
||||||
inlines = [GroupOccupationsInline, PersonsInline, BuzzItemsInline, AwardsInline, LocationsInline]
|
inlines = [GroupOccupationInline, PersonGroupInline, BuzzItemsInline, AwardsInline, LocationsInline]
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TheatreGroup
|
model = TheatreGroup
|
||||||
|
@ -168,9 +168,17 @@ class TheatreGroupForm(ItfForm):
|
||||||
|
|
||||||
|
|
||||||
#Inline definitions and form for Production
|
#Inline definitions and form for Production
|
||||||
|
class PersonProductionForm(ItfForm):
|
||||||
|
person = forms.ModelChoiceField(Person.objects.all(), widget=AutocompleteAddWidget(model_class=Person))
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = PersonProduction
|
||||||
|
|
||||||
|
PersonProductionInline = itf_inlineformset_factory(Production, PersonProduction, form=PersonProductionForm, title="People associated with the production")
|
||||||
|
|
||||||
class ProductionForm(ItfForm):
|
class ProductionForm(ItfForm):
|
||||||
inlines = []
|
inlines = [PersonProductionInline]
|
||||||
|
script = forms.ModelChoiceField(Script.objects.all(), widget=AutocompleteAddWidget(model_class=Script))
|
||||||
director = forms.ModelChoiceField(Person.objects.all(), widget=AutocompleteAddWidget(model_class=Person))
|
director = forms.ModelChoiceField(Person.objects.all(), widget=AutocompleteAddWidget(model_class=Person))
|
||||||
playwright = forms.ModelChoiceField(Person.objects.all(), widget=AutocompleteAddWidget(model_class=Person))
|
playwright = forms.ModelChoiceField(Person.objects.all(), widget=AutocompleteAddWidget(model_class=Person))
|
||||||
group = forms.ModelChoiceField(TheatreGroup.objects.all(), widget=AutocompleteAddWidget(model_class=TheatreGroup))
|
group = forms.ModelChoiceField(TheatreGroup.objects.all(), widget=AutocompleteAddWidget(model_class=TheatreGroup))
|
||||||
|
|
|
@ -8,3 +8,11 @@ class ScriptForm(ItfForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Script
|
model = Script
|
||||||
exclude = ('added_by',)
|
exclude = ('added_by',)
|
||||||
|
|
||||||
|
|
||||||
|
class PopupScriptForm(PopupForm):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Script
|
||||||
|
#fields = ('name', 'email',)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ LANGUAGE_CHOICES = (
|
||||||
|
|
||||||
class Script(ItfModel):
|
class Script(ItfModel):
|
||||||
added_by = models.ForeignKey(User)
|
added_by = models.ForeignKey(User)
|
||||||
form_names = ['ScriptForm']
|
form_names = ['ScriptForm', 'PopupScriptForm']
|
||||||
main_form = 'ScriptForm'
|
main_form = 'ScriptForm'
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
synopsis = models.TextField(blank=True)
|
synopsis = models.TextField(blank=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user