From a30fb940202048d3be470eba73c4fdf74df568e9 Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Mon, 20 Aug 2012 22:59:12 +0200 Subject: [PATCH] TheatreGroup model and getdict complete. rev1.2 minor typo --- itf/itfprofiles/models.py | 103 ++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 50 deletions(-) diff --git a/itf/itfprofiles/models.py b/itf/itfprofiles/models.py index 0a9458b..5104cf7 100644 --- a/itf/itfprofiles/models.py +++ b/itf/itfprofiles/models.py @@ -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):