added ProductionForm, ScriptForm, both working
This commit is contained in:
parent
8137abad92
commit
8ec6b0870c
|
@ -3,6 +3,7 @@ from django.contrib.contenttypes.models import ContentType
|
||||||
from crispy_forms.helper import FormHelper
|
from crispy_forms.helper import FormHelper
|
||||||
|
|
||||||
class ItfForm(forms.ModelForm):
|
class ItfForm(forms.ModelForm):
|
||||||
|
inlines = []
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.helper = FormHelper()
|
self.helper = FormHelper()
|
||||||
|
|
|
@ -155,3 +155,14 @@ class TheatreGroupForm(ItfForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TheatreGroup
|
model = TheatreGroup
|
||||||
exclude = ('added_by', 'locations',)
|
exclude = ('added_by', 'locations',)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ProductionForm(ItfForm):
|
||||||
|
inlines = []
|
||||||
|
director = 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))
|
||||||
|
class Meta:
|
||||||
|
model = Production
|
||||||
|
exclude = ('added_by',)
|
||||||
|
|
|
@ -6,6 +6,7 @@ from django.contrib.localflavor.in_.forms import INZipCodeField
|
||||||
#from ox.django.fields import DictField
|
#from ox.django.fields import DictField
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.contrib.contenttypes import generic
|
from django.contrib.contenttypes import generic
|
||||||
|
from scriptbank.models import Script
|
||||||
|
|
||||||
GENDER_CHOICES = (
|
GENDER_CHOICES = (
|
||||||
('M', 'Male'),
|
('M', 'Male'),
|
||||||
|
@ -203,9 +204,10 @@ class Play(ItfModel):
|
||||||
class Production(ItfModel):
|
class Production(ItfModel):
|
||||||
# user = models.ForeignKey(User)
|
# user = models.ForeignKey(User)
|
||||||
fts_fields = ['name', 'group__name']
|
fts_fields = ['name', 'group__name']
|
||||||
form_names = ['PopupProductionForm']
|
form_names = ['ProductionForm', 'PopupProductionForm']
|
||||||
|
main_form = 'ProductionForm'
|
||||||
added_by = models.ForeignKey(User)
|
added_by = models.ForeignKey(User)
|
||||||
play = models.ForeignKey("Play", null=True, blank=True)
|
script = models.ForeignKey(Script, blank=True, null=True)
|
||||||
name = models.CharField(max_length=255, db_index=True)
|
name = models.CharField(max_length=255, db_index=True)
|
||||||
synopsis = models.TextField(blank=True)
|
synopsis = models.TextField(blank=True)
|
||||||
language = models.ForeignKey("Language", blank=True, null=True)
|
language = models.ForeignKey("Language", blank=True, null=True)
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
from django.forms import ModelForm
|
import floppyforms as forms
|
||||||
from models import Script
|
from models import Script
|
||||||
|
from app.forms import *
|
||||||
|
|
||||||
|
|
||||||
|
class ScriptForm(ItfForm):
|
||||||
|
|
||||||
class ScriptForm(ModelForm):
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Script
|
model = Script
|
||||||
|
exclude = ('added_by',)
|
||||||
|
|
|
@ -22,7 +22,9 @@ LANGUAGE_CHOICES = (
|
||||||
)
|
)
|
||||||
|
|
||||||
class Script(ItfModel):
|
class Script(ItfModel):
|
||||||
user = models.ForeignKey(User)
|
added_by = models.ForeignKey(User)
|
||||||
|
form_names = ['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)
|
||||||
no_characters = models.IntegerField(blank=True, null=True, help_text="Approximate number of characters")
|
no_characters = models.IntegerField(blank=True, null=True, help_text="Approximate number of characters")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user