TheatreGroup model and getdict complete. rev1
This commit is contained in:
parent
0d68ce2388
commit
3373baf8a4
|
@ -267,7 +267,7 @@ class TheatreGroup(ItfModel):
|
|||
email = models.EmailField(blank=True, null=True)
|
||||
# location = models.ForeignKey(Location, blank=True, null=True, related_name="theatregroup_location")
|
||||
tel = models.IntegerField(blank=True, null=True)
|
||||
# -- FIXME tel = models.CharField(blank=True, null=True)
|
||||
# -- FIXME tel = models.CharField(blank=True, null=True)
|
||||
|
||||
languages = models.ManyToManyField("Language", blank=True, null=True)
|
||||
year_founded = models.IntegerField(blank=True, null=True)
|
||||
|
@ -275,7 +275,7 @@ class TheatreGroup(ItfModel):
|
|||
awards = generic.GenericRelation("Award")
|
||||
buzzitems = generic.GenericRelation("BuzzItem")
|
||||
website = models.URLField(blank=True, verify_exists=False)
|
||||
# resources = models.ManyToManyField("Resource", blank=True, null=True)
|
||||
resources = models.ManyToManyField("Resource", blank=True, null=True)
|
||||
locations = generic.GenericRelation("Location"),
|
||||
# locations = models.ManyToManyField("Location", blank=True, null=True, related_name="theatregroup_locations")
|
||||
nature_of_work = models.ManyToManyField("GroupOccupation", blank=True, null=True, through="GroupGroupOccupation")
|
||||
|
@ -285,23 +285,41 @@ class TheatreGroup(ItfModel):
|
|||
trainings = models.ManyToManyField("Training", blank=True, null=True)
|
||||
|
||||
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
def get_dict(self):
|
||||
return {
|
||||
'name': self.name,
|
||||
'about': self.about,
|
||||
'email': self.email,
|
||||
'tel':self.tel,
|
||||
'nature_of_work': [ obj for obj in self.nature_of_work.all().order_by('groupgroupoccupation__is_main')],
|
||||
'venues': [obj for obj in self.locations],
|
||||
#'trainings': [obj for obj in self.trainings_set.all()]
|
||||
'trainings': [obj for obj in self.trainings_set.all()],
|
||||
'languages': [obj.name for obj in self.languages],
|
||||
'venues': [obj for obj in self.locations],
|
||||
'founded': year_founded,
|
||||
'about': self.about,
|
||||
'awards': [obj for obj in self.awards],
|
||||
'website': self.website,
|
||||
'resources': [obj for obj in self.resources],
|
||||
'buzzitems': [obj for obj in self.buzzitems],
|
||||
'productions': [obj for obj in self.productions_set.all() ],
|
||||
'scripts': [obj for obj in self.scripts_set.all() ],
|
||||
}
|
||||
|
||||
def get_title(self):
|
||||
return self.__unicode__()
|
||||
|
||||
class Resource():
|
||||
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)
|
||||
|
||||
|
||||
class PersonGroup(models.Model):
|
||||
person = models.ForeignKey(Person, db_index=True)
|
||||
group = models.ForeignKey(TheatreGroup, db_index=True)
|
||||
|
|
|
@ -3,6 +3,7 @@ from django.contrib.auth.models import User
|
|||
from tagging.fields import TagField
|
||||
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
||||
from app.models import ItfModel
|
||||
from itfprofiles.models import TheatreGroup
|
||||
|
||||
GENRES = (
|
||||
('Fiction', 'Fiction'),
|
||||
|
@ -41,7 +42,7 @@ class Script(ItfModel):
|
|||
license_perform = models.ForeignKey("License", related_name="performance_license", help_text="License for performance rights")
|
||||
fts_fields = ['title', 'synopsis', 'author']
|
||||
fk_fields = ['license_adapt', 'license_perform']
|
||||
|
||||
theatre_group = models.ForeignKey("TheatreGroup", help_text="Theatre Group, if any")
|
||||
# add_form = 'ScriptForm'
|
||||
|
||||
#Meta
|
||||
|
|
Loading…
Reference in New Issue
Block a user