itf/itf/scriptbank/forms.py
2012-09-03 19:25:16 +05:30

40 lines
1.4 KiB
Python
Executable File

import floppyforms as forms
from models import Script, ScriptScript
from app.forms import *
from itfprofiles.models import TheatreGroup
class RelatedScriptsForm(ItfForm):
script2 = forms.ModelChoiceField(Script.objects.all(), widget=AutocompleteAddWidget(model_class=Script))
class Meta:
model = ScriptScript
ScriptScriptInline = itf_inlineformset_factory(Script, ScriptScript, fk_name='script1', form=RelatedScriptsForm, extra=1, title="Add / Edit Related Scripts", help_text="Select related scripts - like 'adaptation of', 'translation of'")
class ScriptForm(ItfForm):
# no_characters = forms.IntegerField(widget=forms.NumberInput())
# no_of_women = forms.IntegerField(widget=forms.NumberInput())
# approx_duration = forms.IntegerField(widget=forms.NumberInput())
# contact = forms.EmailField(widget=forms.EmailInput())
inlines = [ScriptScriptInline]
theatre_group = forms.ModelChoiceField(TheatreGroup.objects.all(), widget=AutocompleteAddWidget(model_class=TheatreGroup))
class Meta:
model = Script
exclude = ('added_by', 'related_scripts')
widgets = {
'no_characters': forms.NumberInput,
'no_of_women': forms.NumberInput,
'approx_duration': forms.NumberInput,
'contact': forms.EmailInput
}
class PopupScriptForm(PopupForm):
class Meta:
model = Script
fields = ('title', 'synopsis',)
#fields = ('name', 'email',)