First draft image gallery
[sommitrealweird.git] / sommitrealweird / photo / templates / photo / photo_index.html
diff --git a/sommitrealweird/photo/templates/photo/photo_index.html b/sommitrealweird/photo/templates/photo/photo_index.html
new file mode 100644 (file)
index 0000000..573d6fe
--- /dev/null
@@ -0,0 +1,39 @@
+{% extends "base.html" %}
+{% load thumbnail %}
+
+{% block content %}
+    {% if object_list %}
+        <h1>{{ object_list.0.album.name }}</h1>
+        <div class="album_caption">{{ object_list.0.album.caption }}</div>
+        {% 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>
+            </div>
+        {% endfor %}
+        <div style="clear: both;">&nbsp;</div>
+        {% if is_paginated %}
+            <p class="paginator">Pages: 
+            {% if page_obj.has_previous %}
+                <a href="?page={{ page_obj.previous_page_number }}">Previous</a> |
+            {% endif %}
+            {% for paginator_page in paginator.page_range %}
+                {% if forloop.first %}
+                {% else %}
+                    |
+                {% endif %}
+                {% ifequal paginator_page page %}
+                    {{ page }}
+                {% else %}
+                    <a href="?page={{ paginator_page }}">{{ paginator_page }}</a>
+                {% endifequal %}
+            {% endfor %}
+            {% if page_obj.has_next %}
+                | <a href="?page={{ page_obj.next_page_number }}">Next</a>
+            {% endif %}
+            </p>
+        {% endif %}
+    {% else %}
+        <p>There are no photos available.</p>
+    {% endif %}
+{% endblock %}