TheatreGroup model and getdict complete. rev1.2 minor typo

This commit is contained in:
Johnson Chetty 2012-08-20 22:59:12 +02:00
parent ef3f0bc2fe
commit a30fb94020

View File

@ -6,7 +6,7 @@ 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 scriptbank.models import Script
GENDER_CHOICES = (
('M', 'Male'),
@ -210,54 +210,6 @@ class Play(ItfModel):
def __unicode__(self):
return self.title
class Production(ItfModel):
# user = models.ForeignKey(User)
fts_fields = ['name', 'group__name']
form_names = ['ProductionForm', 'PopupProductionForm']
main_form = 'ProductionForm'
added_by = models.ForeignKey(User)
script = models.ForeignKey(Script, blank=True, null=True)
name = models.CharField(max_length=255, db_index=True)
synopsis = models.TextField(blank=True)
language = models.ForeignKey("Language", blank=True, null=True)
group = models.ForeignKey("TheatreGroup", blank=True, null=True)
director = models.ForeignKey(Person, related_name='productions_directed', blank=True, null=True)
playwright = models.ForeignKey(Person, related_name='productions_authored', blank=True, null=True)
anecdotes = models.TextField(blank=True)
def __unicode__(self):
return self.name
def get_dict(self):
return {
'name': self.name,
'anecdotes': self.anecdotes,
'group': self.group,
'director': self.director,
'playwright': self.playwright
}
SHOWS_NO_CHOICES = (
('5', '0-5 Shows'),
('10', '6-10 Shows'),
('50', '11-50 Shows'),
('100', '51-100 Shows'),
('1000', 'More Than 100 Shows'),
#add more.
)
class PersonProduction(models.Model):
person = models.ForeignKey(Person, db_index=True)
production = models.ForeignKey(Production, db_index=True)
role = models.CharField(max_length=255)
start_year = models.IntegerField(max_length=4)
years = models.IntegerField(blank=True, null=True)
no_of_shows = models.CharField(max_length=25, choices = SHOWS_NO_CHOICES)
original_cast = models.BooleanField(default=False)
class TheatreGroup(ItfModel):
fts_fields = ['name', 'about']
form_names = ['TheatreGroupForm', 'PopupGroupForm']
@ -312,12 +264,63 @@ class TheatreGroup(ItfModel):
def get_title(self):
return self.__unicode__()
class Resource():
class Resource(models.Model):
title = models.CharField(max_length=255, blank=True)
desc = models.TextField(max_length=10000, blank=True, null =True, help_text="Optional Description, 500 words or less")
fil = models.FileField(upload_to='upload/docs', blank=True, null=True)
url = models.URLField(blank=True, null=True, verify_exists=True)
thumbnail= models.ImageField(upload_to='uploads/docs', blank=True, null=True)
from scriptbank.models import Script
class Production(ItfModel):
# user = models.ForeignKey(User)
fts_fields = ['name', 'group__name']
form_names = ['ProductionForm', 'PopupProductionForm']
main_form = 'ProductionForm'
added_by = models.ForeignKey(User)
script = models.ForeignKey(Script, blank=True, null=True)
name = models.CharField(max_length=255, db_index=True)
synopsis = models.TextField(blank=True)
language = models.ForeignKey("Language", blank=True, null=True)
group = models.ForeignKey("TheatreGroup", blank=True, null=True)
director = models.ForeignKey(Person, related_name='productions_directed', blank=True, null=True)
playwright = models.ForeignKey(Person, related_name='productions_authored', blank=True, null=True)
anecdotes = models.TextField(blank=True)
def __unicode__(self):
return self.name
def get_dict(self):
return {
'name': self.name,
'anecdotes': self.anecdotes,
'group': self.group,
'director': self.director,
'playwright': self.playwright
}
SHOWS_NO_CHOICES = (
('5', '0-5 Shows'),
('10', '6-10 Shows'),
('50', '11-50 Shows'),
('100', '51-100 Shows'),
('1000', 'More Than 100 Shows'),
#add more.
)
class PersonProduction(models.Model):
person = models.ForeignKey(Person, db_index=True)
production = models.ForeignKey(Production, db_index=True)
role = models.CharField(max_length=255)
start_year = models.IntegerField(max_length=4)
years = models.IntegerField(blank=True, null=True)
no_of_shows = models.CharField(max_length=25, choices = SHOWS_NO_CHOICES)
original_cast = models.BooleanField(default=False)
class PersonGroup(models.Model):