hide invalid tabs, set default ordering for models

This commit is contained in:
Sanjay B 2015-08-01 16:35:33 +05:30
parent dce073bfca
commit 020f788f2c
4 changed files with 29 additions and 10 deletions

View File

@ -23,7 +23,7 @@ class ModuleTab(models.Model):
is_default = models.BooleanField(default=False, help_text="Whether this should be the default displayed tab.") 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)") 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") is_displayed = models.BooleanField(default=True, help_text="Uncheck to hide tab")
class Meta: class Meta:
ordering = ['-is_default', 'order'] ordering = ['-is_default', 'order']

View File

@ -69,6 +69,8 @@ class Person(ItfModel):
# reset_token = models.CharField(max_length=256, null=True, editable=False) #s remove these tokens from here # 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) # validate_token = models.CharField(max_length=256, null=True, editable=False)
class Meta:
ordering = ('first_name',)
def __unicode__(self): def __unicode__(self):
return "%s %s" % (self.first_name, self.last_name,) 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() ], 'connections': [obj for obj in self.PersonFrom.all()] + [obj for obj in self.PersonTo.all() ],
'productions': [ obj for obj in self.personproduction_set.all()], 'productions': [ obj for obj in self.personproduction_set.all()],
'trainings': [ obj for obj in self.trainings.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()], 'awards': [ obj for obj in self.awards.all()],
'buzzitems': [ obj for obj in self.buzzitems.all()], 'buzzitems': [ obj for obj in self.buzzitems.all()],
'resources': self.resources.all(), 'resources': self.resources.all(),
@ -372,6 +373,9 @@ class TheatreGroup(ItfModel):
trainings = generic.GenericRelation("Training") trainings = generic.GenericRelation("Training")
allow_comments = models.BooleanField('allow comments', default=True, editable=False) allow_comments = models.BooleanField('allow comments', default=True, editable=False)
class Meta:
ordering = ('name',)
def __unicode__(self): def __unicode__(self):
return self.name return self.name
@ -471,6 +475,9 @@ class Production(ItfModel):
galleries = generic.GenericRelation(GalleryAlbum) galleries = generic.GenericRelation(GalleryAlbum)
#FIXME: add no of shows #FIXME: add no of shows
class Meta:
ordering = ('name',)
def __unicode__(self): def __unicode__(self):
return self.name 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.") 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): class Award(models.Model):
title = models.CharField(max_length=255) title = models.CharField(max_length=255)
year = models.IntegerField(blank=True) year = models.IntegerField(blank=True)

View File

@ -4,10 +4,16 @@
<ul class="tabsInnerRight"> <ul class="tabsInnerRight">
<li><a href="#about">About</a></li> <li><a href="#about">About</a></li>
{% if related_scripts %}
<li><a href="#scripts">Scripts</a></li> <li><a href="#scripts">Scripts</a></li>
{% endif %}
{% if groups or connections %}
<li><a href="#connections">Connections</a></li> <li><a href="#connections">Connections</a></li>
{% endif %}
{% if productions %} <li><a href="#productions">Productions</a></li> {% endif %} {% if productions %} <li><a href="#productions">Productions</a></li> {% endif %}
{% if obj.galleries %}
<li><a href="#gallery">Gallery</a></li> <li><a href="#gallery">Gallery</a></li>
{% endif %}
{% if resources %} <li><a href="#resources">Resources</a></li> {% endif %} {% if resources %} <li><a href="#resources">Resources</a></li> {% endif %}
</ul> </ul>
@ -123,8 +129,8 @@ $(function() {
</div> <!-- end about --> </div> <!-- end about -->
{% if related_scripts %}
<div id="scripts" class="tab_content"> <div id="scripts" class="tab_content">
<div>Help text - to send them to script archive</div>
<br /> <br />
{% for script in related_scripts %} {% for script in related_scripts %}
<a href="{{ script.get_absolute_url }}">{{ script.title }}</a> <a href="{{ script.get_absolute_url }}">{{ script.title }}</a>
@ -133,8 +139,9 @@ $(function() {
{% endfor %} {% endfor %}
</div> <!-- end scripts --> </div> <!-- end scripts -->
{% endif %}
{% if groups or connections %}
<div id="connections" class="tab_content"> <div id="connections" class="tab_content">
<!-- <p><a href="" class="toggleLink">A V Gopalakrishnan</a> Theatre Enthusiast, Mumbai</p>--> <!-- <p><a href="" class="toggleLink">A V Gopalakrishnan</a> Theatre Enthusiast, Mumbai</p>-->
@ -238,6 +245,7 @@ $(function() {
}); });
</script> </script>
</div> <!-- end connections --> </div> <!-- end connections -->
{% endif %}
{% if productions %} {% if productions %}
<div id="productions" class="tab_content"> <div id="productions" class="tab_content">
@ -259,10 +267,11 @@ $(function() {
</div> <!-- end productions --> </div> <!-- end productions -->
{% endif %} {% endif %}
{% if obj.galleries %}
<div id="gallery" class="tab_content"> <div id="gallery" class="tab_content">
{% include 'includes/media_gallery.html' %} {% include 'includes/media_gallery.html' %}
</div> </div>
{% endif %}
{% if resources %} {% if resources %}
<div id="resources" class="tab_content"> <div id="resources" class="tab_content">

View File

@ -12,8 +12,12 @@ $(function() {
<ul class="tabsInnerRight"> <ul class="tabsInnerRight">
{% if shows %}<li><a href="#calendar">Calendar</a></li>{% endif %} {% if shows %}<li><a href="#calendar">Calendar</a></li>{% endif %}
<li><a href="#about">About</a></li> <li><a href="#about">About</a></li>
{% if people %}
<li><a href="#cast">Cast and Crew</a></li> <li><a href="#cast">Cast and Crew</a></li>
{% endif %}
{% if obj.galleries %}
<li><a href="#gallery">Gallery</a></li> <li><a href="#gallery">Gallery</a></li>
{% endif %}
<li><a href="#buzz">Buzz</a></li> <li><a href="#buzz">Buzz</a></li>
{% if user_has_perms or notes %} {% if user_has_perms or notes %}
<li><a href="#notes">Notes</a></li> <li><a href="#notes">Notes</a></li>
@ -134,6 +138,7 @@ $(function() {
<br /> <br />
</div> <!-- end about --> </div> <!-- end about -->
{% if people %}
<div id="cast" class="tab_content"> <div id="cast" class="tab_content">
@ -162,10 +167,13 @@ $(function() {
{% endif %} {% endif %}
</div> </div>
{% endif %}
{% if obj.galleries %}
<div id="gallery" class="tab_content"> <div id="gallery" class="tab_content">
{% include 'includes/media_gallery.html' %} {% include 'includes/media_gallery.html' %}
</div> <!-- end gallery --> </div> <!-- end gallery -->
{% endif %}
<div id="buzz" class="tab_content"> <div id="buzz" class="tab_content">