get dict for Event
This commit is contained in:
parent
80e6b2622e
commit
dab564a6da
|
@ -6,7 +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 itfprofiles.models import City, Location, Production, TheatreGroup, Person
|
from itfprofiles.models import City, Location, Production, TheatreGroup, Person, BuzzItem
|
||||||
from mediagallery.models import GalleryAlbum
|
from mediagallery.models import GalleryAlbum
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ class Event(ItfModel):
|
||||||
end_date = models.DateField(null=True, blank=True, help_text='If event is on a single day, leave blank')
|
end_date = models.DateField(null=True, blank=True, help_text='If event is on a single day, leave blank')
|
||||||
start_time = models.TimeField(null=True, blank=True)
|
start_time = models.TimeField(null=True, blank=True)
|
||||||
end_time = models.TimeField(null=True, blank=True)
|
end_time = models.TimeField(null=True, blank=True)
|
||||||
booking_link = models.URLField(blank=True, null=True, help_text="Ticket booking link, if applicable")
|
booking_link = models.URLField(blank=True, null=True, help_text="Ticket booking link")
|
||||||
tel_no = models.CharField(max_length=100, blank=True)
|
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...")
|
production = models.ForeignKey(Production, blank=True, null=True, help_text="If this is a showing of a production...")
|
||||||
|
buzzitems = generic.GenericRelation(BuzzItem)
|
||||||
galleries = generic.GenericRelation(GalleryAlbum)
|
galleries = generic.GenericRelation(GalleryAlbum)
|
||||||
people = models.ManyToManyField(Person, blank=True, null=True, through="PersonEvent")
|
people = models.ManyToManyField(Person, blank=True, null=True, through="PersonEvent")
|
||||||
image = models.ImageField(upload_to='images/', blank=True, null=True)
|
image = models.ImageField(upload_to='images/', blank=True, null=True)
|
||||||
|
@ -63,13 +63,42 @@ class Event(ItfModel):
|
||||||
# conn = dict()
|
# conn = dict()
|
||||||
# for key in link_keys:
|
# for key in link_keys:
|
||||||
# conn[key]= [obj for obj in links if obj.type==key]
|
# conn[key]= [obj for obj in links if obj.type==key]
|
||||||
#add conn keys to main dict
|
#add conn keys to main dict
|
||||||
return {
|
rdict = {
|
||||||
'title': self.title,
|
'title': self.title,
|
||||||
'oneliner': self.oneliner,
|
'oneliner': self.oneliner,
|
||||||
'description': self.description
|
'description': self.description,
|
||||||
}
|
'event_type': self.event_type,
|
||||||
|
'oneliner':self.oneliner,
|
||||||
|
'is_child': True if self.parent_event != None else False,
|
||||||
|
'city': self.city,
|
||||||
|
'address':self.address,
|
||||||
|
'start_date':self.start_date,
|
||||||
|
'end_date': self.end_date,
|
||||||
|
'start_time': self.start_time,
|
||||||
|
'end_time':self.end_time,
|
||||||
|
'booking_link': self.booking_link,
|
||||||
|
'tel_no':self.tel_no,
|
||||||
|
'image':self.image,
|
||||||
|
'production':self.production,
|
||||||
|
'buzzitems': [ obj for obj in self.buzzitems.all()],
|
||||||
|
|
||||||
|
#'group':,
|
||||||
|
#'galleries':,
|
||||||
|
|
||||||
|
}
|
||||||
|
if self.parent_event:
|
||||||
|
rdict['parent'] = self.parent_event
|
||||||
|
if self.people.all():
|
||||||
|
people= {
|
||||||
|
'attendees': [ obj.person for obj in self.personevent_set.filter(typ='attendee')],
|
||||||
|
'organisers': [ obj.person for obj in self.personevent_set.filter(typ='organiser')],
|
||||||
|
'performers': [ obj.person for obj in self.personevent_set.filter(typ='performer')]
|
||||||
|
}
|
||||||
|
rdict['people']= people
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PERSON_EVENT_CHOICES = (
|
PERSON_EVENT_CHOICES = (
|
||||||
('attendee', 'Attendee'),
|
('attendee', 'Attendee'),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user