From 020f788f2c7282b500a727dba18090c35408e50e Mon Sep 17 00:00:00 2001 From: Sanjay B Date: Sat, 1 Aug 2015 16:35:33 +0530 Subject: [PATCH] hide invalid tabs, set default ordering for models --- itf/insidepages/models.py | 2 +- itf/itfprofiles/models.py | 14 ++++++++------ itf/templates/modules/itfprofiles/person.html | 15 ++++++++++++--- itf/templates/modules/itfprofiles/production.html | 8 ++++++++ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/itf/insidepages/models.py b/itf/insidepages/models.py index 952ba43..78d5239 100755 --- a/itf/insidepages/models.py +++ b/itf/insidepages/models.py @@ -23,7 +23,7 @@ class ModuleTab(models.Model): is_default = models.BooleanField(default=False, help_text="Whether this should be the default displayed tab.") order = models.IntegerField(default=1, help_text="Make number higher to send it lower in order (default will always show first)") is_displayed = models.BooleanField(default=True, help_text="Uncheck to hide tab") - + class Meta: ordering = ['-is_default', 'order'] diff --git a/itf/itfprofiles/models.py b/itf/itfprofiles/models.py index a5246e9..3ee881a 100644 --- a/itf/itfprofiles/models.py +++ b/itf/itfprofiles/models.py @@ -69,6 +69,8 @@ class Person(ItfModel): # reset_token = models.CharField(max_length=256, null=True, editable=False) #s remove these tokens from here # validate_token = models.CharField(max_length=256, null=True, editable=False) + class Meta: + ordering = ('first_name',) def __unicode__(self): return "%s %s" % (self.first_name, self.last_name,) @@ -121,7 +123,6 @@ class Person(ItfModel): 'connections': [obj for obj in self.PersonFrom.all()] + [obj for obj in self.PersonTo.all() ], 'productions': [ obj for obj in self.personproduction_set.all()], 'trainings': [ obj for obj in self.trainings.all()], - '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(), @@ -372,6 +373,9 @@ class TheatreGroup(ItfModel): trainings = generic.GenericRelation("Training") allow_comments = models.BooleanField('allow comments', default=True, editable=False) + class Meta: + ordering = ('name',) + def __unicode__(self): return self.name @@ -471,6 +475,9 @@ class Production(ItfModel): galleries = generic.GenericRelation(GalleryAlbum) #FIXME: add no of shows + class Meta: + ordering = ('name',) + def __unicode__(self): return self.name @@ -558,11 +565,6 @@ class PersonGroup(models.Model): role = models.CharField(max_length=255, blank=True, help_text="What role does this member play in the group? For eg: secretary, director, volunteer, etc.") - - - - - class Award(models.Model): title = models.CharField(max_length=255) year = models.IntegerField(blank=True) diff --git a/itf/templates/modules/itfprofiles/person.html b/itf/templates/modules/itfprofiles/person.html index 9f1d16d..21df27a 100644 --- a/itf/templates/modules/itfprofiles/person.html +++ b/itf/templates/modules/itfprofiles/person.html @@ -4,10 +4,16 @@ @@ -123,8 +129,8 @@ $(function() { +{% if related_scripts %}
-
Help text - to send them to script archive

{% for script in related_scripts %} {{ script.title }} @@ -133,8 +139,9 @@ $(function() { {% endfor %}
+{% endif %} - +{% if groups or connections %}
@@ -238,6 +245,7 @@ $(function() { });
+{% endif %} {% if productions %}
@@ -259,10 +267,11 @@ $(function() {
{% endif %} - +{% if obj.galleries %} +{% endif %} {% if resources %}
diff --git a/itf/templates/modules/itfprofiles/production.html b/itf/templates/modules/itfprofiles/production.html index a6aafce..e8336d3 100644 --- a/itf/templates/modules/itfprofiles/production.html +++ b/itf/templates/modules/itfprofiles/production.html @@ -12,8 +12,12 @@ $(function() {
+{% if people %}
@@ -162,10 +167,13 @@ $(function() { {% endif %}
+{% endif %} +{% if obj.galleries %} +{% endif %}