From ed2b151b5ed8d30720d71a2d934731b7f4292268 Mon Sep 17 00:00:00 2001 From: Sanjay B Date: Tue, 12 Mar 2013 18:28:05 +0530 Subject: [PATCH] event form changes --- itf/events/forms.py | 5 ++++- itf/events/models.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/itf/events/forms.py b/itf/events/forms.py index 995df56..63fcade 100644 --- a/itf/events/forms.py +++ b/itf/events/forms.py @@ -2,6 +2,7 @@ import floppyforms as forms from models import * from app.forms import * from itfprofiles.models import Person, TheatreGroup +from itfprofiles.forms import BuzzItemsInline class PersonEventForm(ItfForm): person = forms.ModelChoiceField(Person.objects.all(), widget=AutocompleteAddWidget(model_class=Person)) @@ -22,8 +23,10 @@ PersonEventInline = itf_inlineformset_factory(Event, PersonEvent, form=PersonEve GroupEventInline = itf_inlineformset_factory(Event, GroupEvent, form=GroupEventForm, extra=1, title="Add / Edit groups associated with this event", help_text="select the groups that are connected to this event") + + class EventForm(ItfForm): - inlines = [PersonEventInline, GroupEventInline] + inlines = [PersonEventInline, GroupEventInline, BuzzItemsInline] parent_event = forms.ModelChoiceField(Event.objects.all(), widget=AutocompleteAddWidget(model_class=Event)) production = forms.ModelChoiceField(Production.objects.all(), widget=AutocompleteAddWidget(model_class=Production)) diff --git a/itf/events/models.py b/itf/events/models.py index fbba30c..4635dba 100644 --- a/itf/events/models.py +++ b/itf/events/models.py @@ -29,7 +29,7 @@ class Event(ItfModel): 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) - city = models.ForeignKey(City) + city = models.ForeignKey(City, blank=True, null=True) address = models.TextField(blank=True) # location = models.ForeignKey(Location) # locations = generic.GenericRelation(Location) @@ -40,6 +40,7 @@ class Event(ItfModel): booking_link = models.URLField(blank=True, null=True, help_text="Ticket booking link, if applicable") tel_no = models.CharField(max_length=100, blank=True) production = models.ForeignKey(Production, blank=True, null=True, help_text="If this is a showing of a production...") + people = models.ManyToManyField(Person, blank=True, null=True, through="PersonEvent") image = models.ImageField(upload_to='images/', blank=True, null=True) groups = models.ManyToManyField(TheatreGroup, blank=True, null=True, through="GroupEvent")