Stop albums from displaying None when they don't need to
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Sun, 29 Mar 2009 14:06:43 +0000 (15:06 +0100)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Sun, 29 Mar 2009 14:06:43 +0000 (15:06 +0100)
sommitrealweird/photo/templates/photo/album_index.html
sommitrealweird/photo/templates/photo/photo_index.html

index 402deedfc0ab4d246474ec49b2b218f91a0965f1..33cbbc63cce2f4325ffbb82632c7299d6a3c3a95 100644 (file)
@@ -10,7 +10,9 @@
                 <a href="{{ album.slug }}/"><img src="{{ album.get_main_image.url|thumbnail:"width=250" }}" alt="{{ album.get_main_image.caption }}" /></a>
                 {% endif %}
                 <h2><a href="{{ album.slug }}/">{{ album.name }}</a></h2>
+                {% if album.caption %}
                 <p>{{ album.caption }}</h2>
+                {% endif %}
             </div>
         {% endfor %}
         {% if is_paginated %}
index 573d6fe98e5e34e10f0cf7d159a2abd7aea53f03..1afcccf5868ad6e6e912ed49d40c711de06838e3 100644 (file)
@@ -4,11 +4,15 @@
 {% block content %}
     {% if object_list %}
         <h1>{{ object_list.0.album.name }}</h1>
+        {% if object_list.0.album.caption %}
         <div class="album_caption">{{ object_list.0.album.caption }}</div>
+        {% endif %}
         {% for photo in object_list %}
             <div class="photo">
                 <a href="{{ photo.id }}/"><img src='{{ photo.image.url|thumbnail:"width=250" }}' alt="{{ photo.caption }}" /></a>
-                <p>{{ photo.caption }}</h2>
+                {% if photo.caption %}
+                <p>{{ photo.caption }}</p>
+                {% endif %}
             </div>
         {% endfor %}
         <div style="clear: both;">&nbsp;</div>