date widgets, events inline for productions

This commit is contained in:
Sanjay B 2013-02-03 03:20:03 +05:30
parent 627968b777
commit ea023e40d3
3 changed files with 25 additions and 3 deletions

View File

@ -30,3 +30,9 @@ class EventForm(ItfForm):
class Meta:
model = Event
exclude = ('people', 'groups',)
widgets = {
'start_date': forms.DateInput,
'end_date': forms.DateInput,
'start_time': forms.TimeInput,
'end_time': forms.TimeInput
}

View File

@ -25,7 +25,7 @@ class Event(ItfModel):
fts_fields = ['title', 'oneliner', 'description']
added_by = models.ForeignKey(User, editable=False, null=True, blank=True)
title = models.CharField(max_length=1024)
event_type = models.CharField(choices=EVENT_TYPE_CHOICES, max_length=64)
event_type = models.CharField(choices=EVENT_TYPE_CHOICES, max_length=64, blank=True)
oneliner = models.CharField(max_length=1024,help_text="Event slogan/one liner", blank=True)
description = models.TextField(blank=True, null=True)
parent_event = models.ForeignKey("Event", related_name='child_events', help_text='If this event is part of another event', blank=True, null=True)

View File

@ -13,7 +13,7 @@ from imagestore.forms import AlbumForm, ImageForm
from itfprofiles.models import *
from scriptbank.models import Script
#Forms and Inlines for Generic Classes
from events.models import Event
#class AlbumInlineForm(ItfForm, AlbumForm):
# pass
@ -68,6 +68,22 @@ class PadmaClipForm(ItfForm):
PadmaClipsInline = itf_inlineformset_factory(PadmaClip, extra=1, is_generic=True, form=PadmaClipForm, title="Videos")
class EventsInlineForm(ItfForm):
parent_event = forms.ModelChoiceField(Event.objects.all(), widget=AutocompleteAddWidget(model_class=Event))
class Meta:
model = Event
exclude = ('people', 'groups', 'event_type',)
widgets = {
'start_date': forms.DateInput,
'end_date': forms.DateInput,
'start_time': forms.TimeInput,
'end_time': forms.TimeInput
}
EventsInline = itf_inlineformset_factory(Production, Event, extra=2, form=EventsInlineForm, title="Performances", is_generic=False)
#AlbumsInline = itf_inlineformset_factory(Album, extra=1, is_generic=True, form=AlbumInlineForm, title="Photo Albums")
@ -226,7 +242,7 @@ class PersonProductionForm(ItfForm):
PersonProductionInline = itf_inlineformset_factory(Production, PersonProduction, form=PersonProductionForm, title="People associated with the production")
class ProductionForm(ItfForm):
inlines = [PersonProductionInline, AwardsInline]
inlines = [PersonProductionInline, AwardsInline, EventsInline]
script = forms.ModelChoiceField(Script.objects.all(), widget=AutocompleteAddWidget(model_class=Script))
languages = forms.ModelMultipleChoiceField(Language.objects.all(), widget=forms.CheckboxSelectMultiple())
director = forms.ModelChoiceField(Person.objects.all(), widget=AutocompleteAddWidget(model_class=Person))