From 780d883e043b1fb84b00dd5f4d9349bea81ec0fd Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 3 Jan 2013 06:40:17 +0530 Subject: [PATCH] plug-in related scripts, etc. into templates --- itf/itfprofiles/models.py | 7 +- itf/scriptbank/models.py | 3 +- itf/templates/modules/itfprofiles/person.html | 14 ++-- .../modules/itfprofiles/theatregroup.html | 57 +++------------ itf/templates/modules/scriptbank/script.html | 71 ++++++------------- 5 files changed, 43 insertions(+), 109 deletions(-) diff --git a/itf/itfprofiles/models.py b/itf/itfprofiles/models.py index 3257687..90b859f 100644 --- a/itf/itfprofiles/models.py +++ b/itf/itfprofiles/models.py @@ -101,7 +101,8 @@ class Person(ItfModel): 'languages': [ obj for obj in self.languages.all()], 'awards': [ obj for obj in self.awards.all()], 'buzzitems': [ obj for obj in self.buzzitems.all()], - 'resources': self.resources.all() + 'resources': self.resources.all(), + 'related_scripts': self.related_scripts() } def related_scripts(self): @@ -354,6 +355,7 @@ class TheatreGroup(ItfModel): 'productions': [obj for obj in self.production_set.all() ], 'scripts': [obj for obj in self.script_set.all() ], 'people' : [obj for obj in self.persongroup_set.all() ], + 'worked_with_people': self.worked_with_people() } def worked_with_people(self): @@ -438,7 +440,8 @@ class Production(ItfModel): 'languages': [ obj for obj in self.languages.all()], 'debut_date':self.debut_date, 'sibling_productions': rel_level1, - 'related_productions' : rel_level2, + 'related_productions' : rel_level2, + 'people': self.get_people() } diff --git a/itf/scriptbank/models.py b/itf/scriptbank/models.py index 5cdad3e..c6ef051 100755 --- a/itf/scriptbank/models.py +++ b/itf/scriptbank/models.py @@ -87,7 +87,8 @@ class Script(ItfModel): 'license_adapt': self.license_adapt, 'license_perform': self.license_perform, 'productions': self.production_set.all(), - 'related_scripts': self.related_scripts + 'related_scripts': self.related_scripts, + 'related_people': self.related_people() } def related_people(self): diff --git a/itf/templates/modules/itfprofiles/person.html b/itf/templates/modules/itfprofiles/person.html index 56f0e5b..034471e 100644 --- a/itf/templates/modules/itfprofiles/person.html +++ b/itf/templates/modules/itfprofiles/person.html @@ -102,17 +102,11 @@
Help text - to send them to script archive

- Title -
One line description. Extra information goes here
-
- - Title -
One line description. Extra information goes here
-
- - Title -
One line description. Extra information goes here
+ {% for script in related_scripts %} + {{ script.title }} +
{{ script.synopsis }}

+ {% endfor %}
diff --git a/itf/templates/modules/itfprofiles/theatregroup.html b/itf/templates/modules/itfprofiles/theatregroup.html index 95e5e14..8cffd04 100644 --- a/itf/templates/modules/itfprofiles/theatregroup.html +++ b/itf/templates/modules/itfprofiles/theatregroup.html @@ -107,9 +107,11 @@
- -
Worked with (not implemented)
+ {% if worked_with_people %} + +
Worked with

+ {% for p in worked_with_people %}
@@ -117,58 +119,17 @@
- Name of Group -
Location
-
Relationship to Group (e.g. admin)
+ {{ p.person.first_name }} {{ p.person.last_name }} +
{{ p.role }}: {{ p.name }}
+
-
-
- /static/images/150x150.jpg -
- -
- Name of Person -
Occupation/one-line desc
-
Location
-
-
- -
- - -
-
- /static/images/150x150.jpg -
- -
- Name of Person -
Occupation/one-line desc
-
Location
-
-
- -
- -
-
- /static/images/150x150.jpg -
- -
- Name of Person -
Location
-
Relationship to Group (e.g. admin)
-
-
- -
+ {% endfor %} - More>> +
diff --git a/itf/templates/modules/scriptbank/script.html b/itf/templates/modules/scriptbank/script.html index 97a4327..175654a 100755 --- a/itf/templates/modules/scriptbank/script.html +++ b/itf/templates/modules/scriptbank/script.html @@ -13,7 +13,7 @@ $(function() {