event foreignkey / m2m relations
This commit is contained in:
parent
993ffc69d2
commit
0fa7b5346f
|
@ -6,13 +6,14 @@ from django.contrib.localflavor.in_.forms import INZipCodeField
|
|||
#from ox.django.fields import DictField
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.contenttypes import generic
|
||||
from itfprofiles.models import Location
|
||||
from itfprofiles.models import Location, Production, TheatreGroup, Person
|
||||
|
||||
|
||||
|
||||
class Event(ItfModel):
|
||||
#ItfModel stuff:
|
||||
#form_names = ['PersonForm', 'PopupPersonForm']
|
||||
#fts_fields = ['first_name', 'last_name', 'email', 'about']
|
||||
fts_fields = ['title', 'oneliner', 'description']
|
||||
|
||||
title = models.CharField(max_length=1024)
|
||||
oneliner = models.CharField(max_length=1024,help_text="Event slogan/one liner")
|
||||
|
@ -22,11 +23,12 @@ class Event(ItfModel):
|
|||
end_date = models.DateTimeField()
|
||||
booking_link = models.URLField(blank=True, null=True, help_text="Ticket booking")
|
||||
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)
|
||||
|
||||
#Entities and Connections -
|
||||
connections = generic.GenericRelation("Connection")
|
||||
# connections = generic.GenericRelation("Connection")
|
||||
|
||||
|
||||
def __unicode__(self):
|
||||
|
@ -49,6 +51,18 @@ class Event(ItfModel):
|
|||
'description': self.description
|
||||
}
|
||||
|
||||
|
||||
PERSON_EVENT_CHOICES = (
|
||||
('attendee', 'Attendee'),
|
||||
('organiser', 'Organiser'),
|
||||
('performer', 'Performer'),
|
||||
)
|
||||
|
||||
class PersonEvent(models.Model):
|
||||
person = models.ForeignKey(Person)
|
||||
event = models.ForeignKey(Event):
|
||||
typ = models.CharField(choices=PERSON_EVENT_CHOICES)
|
||||
|
||||
class Connection(models.Model):
|
||||
link_type = models.CharField(max_length=255)
|
||||
extra_text = models.CharField(max_length=1024)
|
||||
|
|
Loading…
Reference in New Issue
Block a user