Debug in templates. All fragments page added. Language files updated.
Binary file src/egonomy/locale/en/LC_MESSAGES/django.mo has changed
--- a/src/egonomy/locale/en/LC_MESSAGES/django.po Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/locale/en/LC_MESSAGES/django.po Wed Feb 06 13:15:27 2013 +0100
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-02-05 10:34-0600\n"
+"POT-Creation-Date: 2013-02-06 06:09-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -25,18 +25,24 @@
msgid "English"
msgstr ""
+#: templates/egonomy_all_fragments.html:7
+#: templates/egonomy_all_fragments.html:12 templates/egonomy_home.html:59
+msgid "All fragments"
+msgstr ""
+
+#: templates/egonomy_all_fragments.html:40
+#: templates/egonomy_all_pictures.html:40
+#: templates/egonomy_annotate_picture.html:98
+#: templates/egonomy_create_fragment.html:99 templates/egonomy_home.html:50
+#: templates/egonomy_home.html.py:92 templates/egonomy_view_fragment.html:89
+msgid "Annotated by"
+msgstr ""
+
#: templates/egonomy_all_pictures.html:7
#: templates/egonomy_all_pictures.html:12 templates/egonomy_home.html:23
msgid "All pictures"
msgstr ""
-#: templates/egonomy_all_pictures.html:40
-#: templates/egonomy_annotate_picture.html:102
-#: templates/egonomy_create_fragment.html:103 templates/egonomy_home.html:50
-#: templates/egonomy_home.html.py:91 templates/egonomy_view_fragment.html:89
-msgid "Annotated by"
-msgstr ""
-
#: templates/egonomy_annotate_picture.html:6
msgid "Annotate a picture"
msgstr ""
@@ -65,38 +71,31 @@
msgid "RMN keywords"
msgstr ""
-#: templates/egonomy_annotate_picture.html:50
-#: templates/egonomy_create_fragment.html:51
-#: templates/egonomy_view_fragment.html:37
-msgid "Users keywords"
-msgstr ""
-
-#: templates/egonomy_annotate_picture.html:55
+#: templates/egonomy_annotate_picture.html:51
#: templates/egonomy_view_fragment.html:42
msgid "Save keywords"
msgstr ""
-#: templates/egonomy_annotate_picture.html:58
-#: templates/egonomy_create_fragment.html:59
-#: templates/egonomy_view_fragment.html:45
-msgid "Last modification"
+#: templates/egonomy_annotate_picture.html:54
+msgid "Last fragment created"
msgstr ""
-#: templates/egonomy_annotate_picture.html:64
+#: templates/egonomy_annotate_picture.html:55 templates/egonomy_base.html:22
+#: templates/egonomy_view_fragment.html:46
+msgid "by"
+msgstr ""
+
+#: templates/egonomy_annotate_picture.html:60
#: templates/egonomy_view_fragment.html:51
msgid "Create a fragment"
msgstr ""
-#: templates/egonomy_annotate_picture.html:70
-#: templates/egonomy_create_fragment.html:71
+#: templates/egonomy_annotate_picture.html:66
+#: templates/egonomy_create_fragment.html:67
#: templates/egonomy_view_fragment.html:57
msgid "Fragments from this picture"
msgstr ""
-#: templates/egonomy_base.html:22
-msgid "by"
-msgstr ""
-
#: templates/egonomy_base.html:24
msgid "Search"
msgstr ""
@@ -140,7 +139,17 @@
msgid "Fragment's description"
msgstr ""
-#: templates/egonomy_create_fragment.html:64
+#: templates/egonomy_create_fragment.html:51
+#: templates/egonomy_view_fragment.html:37
+msgid "Users keywords"
+msgstr ""
+
+#: templates/egonomy_create_fragment.html:55
+#: templates/egonomy_view_fragment.html:45
+msgid "Last modification"
+msgstr ""
+
+#: templates/egonomy_create_fragment.html:60
msgid "Save the fragment"
msgstr ""
@@ -172,7 +181,7 @@
msgid "Last created fragments"
msgstr ""
-#: templates/egonomy_home.html:90
+#: templates/egonomy_home.html:91
msgid "Fragment from"
msgstr ""
Binary file src/egonomy/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/egonomy/locale/fr/LC_MESSAGES/django.po Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/locale/fr/LC_MESSAGES/django.po Wed Feb 06 13:15:27 2013 +0100
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-02-05 10:34-0600\n"
+"POT-Creation-Date: 2013-02-06 06:09-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -26,21 +26,28 @@
msgid "English"
msgstr "Anglais"
+#: templates/egonomy_all_fragments.html:7
+#: templates/egonomy_all_fragments.html:12
+#: templates/egonomy_home.html:59
+msgid "All fragments"
+msgstr "Tous les fragments"
+
+#: templates/egonomy_all_fragments.html:40
+#: templates/egonomy_all_pictures.html:40
+#: templates/egonomy_annotate_picture.html:98
+#: templates/egonomy_create_fragment.html:99
+#: templates/egonomy_home.html:50
+#: templates/egonomy_home.html.py:92
+#: templates/egonomy_view_fragment.html:89
+msgid "Annotated by"
+msgstr "Annoté par"
+
#: templates/egonomy_all_pictures.html:7
#: templates/egonomy_all_pictures.html:12
#: templates/egonomy_home.html:23
msgid "All pictures"
msgstr "Toutes les images"
-#: templates/egonomy_all_pictures.html:40
-#: templates/egonomy_annotate_picture.html:102
-#: templates/egonomy_create_fragment.html:103
-#: templates/egonomy_home.html:50
-#: templates/egonomy_home.html.py:91
-#: templates/egonomy_view_fragment.html:89
-msgid "Annotated by"
-msgstr "Annoté par"
-
#: templates/egonomy_annotate_picture.html:6
msgid "Annotate a picture"
msgstr "Annoter une image"
@@ -69,38 +76,32 @@
msgid "RMN keywords"
msgstr "Mots-clés RMN"
-#: templates/egonomy_annotate_picture.html:50
-#: templates/egonomy_create_fragment.html:51
-#: templates/egonomy_view_fragment.html:37
-msgid "Users keywords"
-msgstr "Mots-clés Utilisateurs"
-
-#: templates/egonomy_annotate_picture.html:55
+#: templates/egonomy_annotate_picture.html:51
#: templates/egonomy_view_fragment.html:42
msgid "Save keywords"
msgstr "Enregistrer les mots-clés"
-#: templates/egonomy_annotate_picture.html:58
-#: templates/egonomy_create_fragment.html:59
-#: templates/egonomy_view_fragment.html:45
-msgid "Last modification"
-msgstr "Dernière modification"
+#: templates/egonomy_annotate_picture.html:54
+msgid "Last fragment created"
+msgstr "Dernier fragment créé"
-#: templates/egonomy_annotate_picture.html:64
+#: templates/egonomy_annotate_picture.html:55
+#: templates/egonomy_base.html:22
+#: templates/egonomy_view_fragment.html:46
+msgid "by"
+msgstr "par"
+
+#: templates/egonomy_annotate_picture.html:60
#: templates/egonomy_view_fragment.html:51
msgid "Create a fragment"
msgstr "Créer un fragment"
-#: templates/egonomy_annotate_picture.html:70
-#: templates/egonomy_create_fragment.html:71
+#: templates/egonomy_annotate_picture.html:66
+#: templates/egonomy_create_fragment.html:67
#: templates/egonomy_view_fragment.html:57
msgid "Fragments from this picture"
msgstr "Fragments de cette image"
-#: templates/egonomy_base.html:22
-msgid "by"
-msgstr "par"
-
#: templates/egonomy_base.html:24
msgid "Search"
msgstr "Rechercher"
@@ -144,7 +145,17 @@
msgid "Fragment's description"
msgstr "Description du fragment"
-#: templates/egonomy_create_fragment.html:64
+#: templates/egonomy_create_fragment.html:51
+#: templates/egonomy_view_fragment.html:37
+msgid "Users keywords"
+msgstr "Mots-clés Utilisateurs"
+
+#: templates/egonomy_create_fragment.html:55
+#: templates/egonomy_view_fragment.html:45
+msgid "Last modification"
+msgstr "Dernière modification"
+
+#: templates/egonomy_create_fragment.html:60
msgid "Save the fragment"
msgstr "Enregistrer le fragment"
@@ -176,7 +187,7 @@
msgid "Last created fragments"
msgstr "Derniers fragments créés"
-#: templates/egonomy_home.html:90
+#: templates/egonomy_home.html:91
msgid "Fragment from"
msgstr "Fragment de"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/egonomy/templates/egonomy_all_fragments.html Wed Feb 06 13:15:27 2013 +0100
@@ -0,0 +1,53 @@
+{% extends "egonomy_base.html" %}
+{% load static %}
+{% load i18n %}
+{% load thumbnail %}
+{% load navigation %}
+
+{% block title %}{% trans "All fragments" %}{% endblock %}
+
+{% block content %}
+ <div class="fullwidth">
+ <div class="fullwidth">
+ <h2>{% trans "All fragments" %}</h2>
+ {% if nb_pages %}<p>{% build_pagination nb_pages cur_page_nb "all_fragments" "contents_page clickable" %}</p>{% endif %}
+ <ul class="fullwidth">
+ {% for frg in results %}
+ <li class="subcol_all">
+ <a href="{% url 'view_fragment' fragment_pk=prg.pk %}">
+ <div class="center-image">
+ <div class="image-and-fragment">
+ {% with frg.image.info.image_file as image %}
+ {% if image %}
+ {% if image|is_portrait %}
+ {% thumbnail image "x110" format="PNG" crop="center" as im %}
+ <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/>
+ {% empty %}
+ <img src="{% static 'egonomy/img/empty.gif' %}" width="110" height="110" class="placeholder" />
+ {% endthumbnail %}
+ {% else %}
+ {% thumbnail image "110" format="PNG" crop="center" as im %}
+ <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"/>
+ {% empty %}
+ <img src="{% static 'egonomy/img/empty.gif' %}" width=110" height="110" class="placeholder" />
+ {% endthumbnail %}
+ {% endif %}
+ {% else %}
+ <img src="{% static 'egonomy/img/empty.gif' %}" width=110" height="110" class="placeholder" />
+ {% endif %}
+ {% endwith %}
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">
+ <path d="{{ frg.coordinates }}" stroke="red" stroke-width=".02" fill="red" fill-opacity=".3" />
+ </svg>
+ </div>
+ </div>
+ <h3>{{ frg.title }}</h3></a>
+ <p>{% trans "Annotated by" %} <strong>{{ frg.author }}</strong></p>
+ </li>
+ {% endfor %}
+ </ul>
+ {% if nb_pages %}<p>{% build_pagination nb_pages cur_page_nb "all_fragments" "contents_page clickable" %}</p>{% endif %}
+ </div>
+ </div>
+{% endblock %}
+
--- a/src/egonomy/templates/egonomy_all_pictures.html Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/templates/egonomy_all_pictures.html Wed Feb 06 13:15:27 2013 +0100
@@ -10,7 +10,7 @@
<div class="fullwidth">
<div class="fullwidth">
<h2>{% trans "All pictures" %}</h2>
- {% if nb_pages %}<p>{% build_pagination nb_pages page "contents_page clickable" %}</p>{% endif %}
+ {% if nb_pages %}<p>{% build_pagination nb_pages cur_page_nb "all_pictures" "contents_page clickable" %}</p>{% endif %}
<ul class="fullwidth">
{% for img in results %}
<li class="subcol_all">
@@ -41,7 +41,7 @@
</li>
{% endfor %}
</ul>
- {% if nb_pages %}<p>{% build_pagination nb_pages page "contents_page clickable" %}</p>{% endif %}
+ {% if nb_pages %}<p>{% build_pagination nb_pages cur_page_nb "all_pictures" "contents_page clickable" %}</p>{% endif %}
</div>
</div>
{% endblock %}
--- a/src/egonomy/templates/egonomy_annotate_picture.html Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/templates/egonomy_annotate_picture.html Wed Feb 06 13:15:27 2013 +0100
@@ -24,39 +24,35 @@
<table class="image-metadata">
<tr>
<th>{% trans "Description" %} :</th>
- <td>{{ img.metadata.description }}</td>
+ <td>{% if img.metadata.description %}{{ img.metadata.description }}{% endif %}</td>
</tr>
<tr>
<th>{% trans "Author" %} :</th>
- <td>{{ img.metadata.auteur }}</td>
+ <td>{% if img.metadata.auteur %}{{ img.metadata.auteur }}{% endif %}</td>
</tr>
<tr>
<th>{% trans "Period" %} :</th>
- <td>{{ img.metadata.periode }}</td>
+ <td>{% if img.metadata.periode %}{{ img.metadata.periode }}{% endif %}</td>
</tr>
<tr>
<th>{% trans "Production site" %} :</th>
- <td>{{ img.metadata.site }}</td>
+ <td>{% if img.metadata.site %}{{ img.metadata.site }}{% endif %}</td>
</tr>
<tr>
<th>{% trans "Localization" %} :</th>
- <td>{{ img.metadata.lieu }}</td>
+ <td>{% if img.metadata.lieu %}{{ img.metadata.lieu }}{% endif %}</td>
</tr>
<tr>
<th>{% trans "RMN keywords" %} :</th>
- <td>{{ img.metadata.mots_cles }}</td>
+ <td>{% if img.metadata.mots_cles %}{{ img.metadata.mots_cles }}{% endif %}</td>
</tr>
- <tr>
- <th>{% trans "Users keywords" %}</th>
- <td><textarea class="user-keywords">{{ img.metadata.users_keywords }}</textarea></td>
- </tr>
- <tr>
+ <!--tr>
<th> </th>
<td><input class="user-submit" type="submit" value="{% trans 'Save keywords' %}" /></td>
- </tr>
+ </tr-->
<tr>
- <th>{% trans "Last modification" %} :</th>
- <td>le 23 janvier 2013 par Utilisateur17</td>
+ <th>{% trans "Last fragment created" %} :</th>
+ <td>{% if last_frg %}<a href="{% url 'view_fragment' fragment_pk=last_frg.pk %}">{{ last_frg.title }}</a>, {{ last_frg.date_saved }} {% trans 'by' %} <strong>{{ last_frg.author }}</strong>{% endif %}</td>
</tr>
</table>
</form>
@@ -71,7 +67,7 @@
<ul class="fullwidth">
{% for frg in fragment_list %}
<li class="subcol subcol-eighth">
- <a href="{% url 'view_fragment' fragment_pk='1' %}">
+ <a href="{% url 'view_fragment' fragment_pk=frg.pk %}">
<div class="center-image">
<div class="image-and-fragment">
{% with frg.image.info.image_file as image %}
--- a/src/egonomy/templates/egonomy_create_fragment.html Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/templates/egonomy_create_fragment.html Wed Feb 06 13:15:27 2013 +0100
@@ -29,7 +29,7 @@
{% endwith %}
<div class="cutout-canvas"></div>
</div>
- <input name="fragment_path" id="fragment_path" type="text" class="fragment-path column-half" value="M 0 .5 L .5 0 L 1 .5 L .5 1 Z" />
+ <input name="fragment_path" id="fragment_path" type="text" class="fragment-path column-half" value="M0.1 0.5L0.5 0.1L0.9 0.5L0.5 0.9Z" />
<input name="image_id" id="image_id" type="hidden" value="{{ img.id }}" />
{% csrf_token %}
</div>
@@ -51,14 +51,10 @@
<th>{% trans 'Users keywords' %} :</th>
<td><textarea class="user-keywords" name="users_keywords" id="users_keywords"></textarea></td>
</tr>
- <tr>
- <th> </th>
- <td></td>
- </tr>
- <tr>
+ <!--tr>
<th>{% trans 'Last modification' %} :</th>
<td>le 23 janvier 2013 par Utilisateur17</td>
- </tr>
+ </tr-->
</table>
<div class="fullwidth">
<input class="user-submit" type="submit" value="{% trans 'Save the fragment' %}" />
@@ -72,7 +68,7 @@
<ul class="fullwidth">
{% for frg in fragment_list %}
<li class="subcol subcol-eighth">
- <a href="{% url 'view_fragment' fragment_pk=1 %}">
+ <a href="{% url 'view_fragment' fragment_pk=frg.pk %}">
<div class="center-image">
<div class="image-and-fragment">
{% with frg.image.info.image_file as image %}
--- a/src/egonomy/templates/egonomy_home.html Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/templates/egonomy_home.html Wed Feb 06 13:15:27 2013 +0100
@@ -55,7 +55,8 @@
<!-- Liste des derniers fragments modifiés -->
<div class="column column-half">
- <h2>{% if search %}{% trans "Corresponding fragments" %}{% else %}{% trans "Last created fragments" %}{% endif %}</h2>
+ <h2>{% if search %}{% trans "Corresponding fragments" %}{% else %}{% trans "Last created fragments" %}{% endif %}
+ <span class="right"><a href="{% url 'all_fragments' %}" alt="{% trans "All fragments" %}">{% trans "All fragments" %}</a></span></h2>
<ul class="fullwidth">
{% for frg in fragment_list %}
<li class="subcol subcol-half-fourth">
@@ -87,7 +88,7 @@
</div>
</div>
<h3>{{ frg.title }}</h3></a>
- <h4>{% trans "Fragment from" %} <a href="{% url 'annotate_picture' image_id='01-013015' %}">{{ frg.image.metadata.titre }}</a></h4>
+ <h4>{% trans "Fragment from" %} <a href="{% url 'annotate_picture' image_id=frg.image.id %}">{{ frg.image.metadata.titre }}</a></h4>
<p>{% trans "Annotated by" %} <strong>{{ frg.author }}</strong></p>
</li>
{% endfor %}
--- a/src/egonomy/templates/egonomy_view_fragment.html Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/templates/egonomy_view_fragment.html Wed Feb 06 13:15:27 2013 +0100
@@ -35,15 +35,15 @@
</tr>
<tr>
<th>{% trans "Users keywords" %}</th>
- <td><textarea class="user-keywords">{{ fragment.tags }}</textarea></td>
+ <td>{{ fragment.tags }}</td>
</tr>
- <tr>
+ <!--tr>
<th> </th>
<td><input class="user-submit" type="submit" value="{% trans 'Save keywords' %}" /></td>
- </tr>
+ </tr-->
<tr>
<th>{% trans "Last modification" %} :</th>
- <td>le 23 janvier 2013 par Utilisateur17</td>
+ <td>{{ fragment.date_saved }} {% trans 'by' %} <strong>{{ fragment.author }}</strong></td>
</tr>
</table>
</form>
@@ -58,7 +58,7 @@
<ul class="fullwidth">
{% for frg in fragment_list %}
<li class="subcol subcol-eighth">
- <a href="{% url 'view_fragment' fragment_pk='1' %}">
+ <a href="{% url 'view_fragment' fragment_pk=frg.pk %}">
<div class="center-image">
<div class="image-and-fragment">
{% with frg.image.info.image_file as image %}
--- a/src/egonomy/templates/partial/all_pictures_pagination.html Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/templates/partial/all_pictures_pagination.html Wed Feb 06 13:15:27 2013 +0100
@@ -1,21 +1,21 @@
{% if nb_pages %}
{% comment %}alors ? : {{begin}} - {{middle}} - {{end}} - nb_pages = {{nb_pages}}<br/>
alors ? : nb_pages = {{nb_pages}} - range = {{nb_pages}} - cur_page_nb = {{cur_page_nb}}<br/>{% endcomment %}
- {% if 1 < cur_page_nb %}<a class="{{a_class}}" alt="prev" href="{% url 'all_pictures' %}?page={{cur_page_nb|add:'-1'}}"><<</a> {% endif %}
+ {% if 1 < cur_page_nb %}<a class="{{a_class}}" alt="prev" href="{% url url_to %}?page={{cur_page_nb|add:'-1'}}"><<</a> {% endif %}
{% for i in begin %}
- {% if i == cur_page_nb %}{{i}}{% else %}<a class="{{a_class}}" alt="{{i}}" href="{% url 'all_pictures' %}?page={{i}}">{{i}}</a>{% endif %}
+ {% if i == cur_page_nb %}{{i}}{% else %}<a class="{{a_class}}" alt="{{i}}" href="{% url url_to %}?page={{i}}">{{i}}</a>{% endif %}
{% endfor %}
{% if middle %}
...
{% for i in middle %}
- {% if i == cur_page_nb %}{{i}}{% else %}<a class="{{a_class}}" alt="{{i}}" href="{% url 'all_pictures' %}?page={{i}}">{{i}}</a>{% endif %}
+ {% if i == cur_page_nb %}{{i}}{% else %}<a class="{{a_class}}" alt="{{i}}" href="{% url url_to %}?page={{i}}">{{i}}</a>{% endif %}
{% endfor %}
{% endif %}
{% if end %}
...
{% for i in end %}
- {% if i == cur_page_nb %}{{i}}{% else %}<a class="{{a_class}}" alt="{{i}}" href="{% url 'all_pictures' %}?page={{i}}">{{i}}</a>{% endif %}
+ {% if i == cur_page_nb %}{{i}}{% else %}<a class="{{a_class}}" alt="{{i}}" href="{% url url_to %}?page={{i}}">{{i}}</a>{% endif %}
{% endfor %}
{% endif %}
- {% if cur_page_nb < nb_pages %}<a class="{{a_class}}" alt="next" href="{% url 'all_pictures' %}?page={{cur_page_nb|add:'1'}}">>></a>{% endif %}
+ {% if cur_page_nb < nb_pages %}<a class="{{a_class}}" alt="next" href="{% url url_to %}?page={{cur_page_nb|add:'1'}}">>></a>{% endif %}
{% endif %}
\ No newline at end of file
--- a/src/egonomy/templatetags/navigation.py Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/templatetags/navigation.py Wed Feb 06 13:15:27 2013 +0100
@@ -20,7 +20,7 @@
@register.inclusion_tag("partial/all_pictures_pagination.html", takes_context=True)
-def build_pagination(context, nb_pages, cur_page_nb, a_class, begin_pages=2, end_pages=2, before_current_pages=2, after_current_pages=2):
+def build_pagination(context, nb_pages, cur_page_nb, url_to, a_class, begin_pages=2, end_pages=2, before_current_pages=2, after_current_pages=2):
# Digg-like pagination. Adapted from http://djangosnippets.org/snippets/2199/
nb_pages = int(nb_pages)
cur_page_nb = int(cur_page_nb)
@@ -71,6 +71,7 @@
'end' : end,
'nb_pages' : nb_pages,
'cur_page_nb' : cur_page_nb,
+ 'url_to' : url_to,
'a_class' : a_class})
#assert False, begin + middle + end
return context
--- a/src/egonomy/urls.py Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/urls.py Wed Feb 06 13:15:27 2013 +0100
@@ -13,7 +13,8 @@
url(r'^viewfragment/(?P<fragment_pk>.*)/$', 'egonomy.views.view_fragment', name='view_fragment'),
url(r'^createfragment/(?P<image_id>.*)/$', 'egonomy.views.create_fragment', name='create_fragment'),
url(r'^savefragment/$', 'egonomy.views.save_fragment', name='save_fragment'),
- url(r'^all/$', 'egonomy.views.all_pictures', name='all_pictures'),
+ url(r'^allpictures/$', 'egonomy.views.all_pictures', name='all_pictures'),
+ url(r'^allfragments/$', 'egonomy.views.all_fragments', name='all_fragments'),
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
--- a/src/egonomy/views.py Tue Feb 05 19:19:55 2013 +0100
+++ b/src/egonomy/views.py Wed Feb 06 13:15:27 2013 +0100
@@ -31,10 +31,13 @@
def annotate_picture(request, image_id):
img = get_object_or_404(Image, id=image_id)
- frg_list = Fragment.objects.filter(image=img)
+ frg_list = Fragment.objects.filter(image=img).order_by('-date_saved')
+ last_frg = None
+ if frg_list.count()>0:
+ last_frg = frg_list[0]
return render_to_response("egonomy_annotate_picture.html",
- {'img': img, 'fragment_list': frg_list, 'image_id':image_id},
+ {'img': img, 'fragment_list': frg_list, 'last_frg':last_frg},
context_instance=RequestContext(request))
@@ -82,20 +85,39 @@
def all_pictures(request):
- # Get the page number parameter if possible
- page = request.GET.get("page") or 1
- page = int(page)
+ # Get the cur_page_nb number parameter if possible
+ cur_page_nb = request.GET.get("page") or 1
+ cur_page_nb = int(cur_page_nb)
img_list = Image.objects.all().order_by('pk')
nb = 32
paginator = Paginator(img_list, nb)
try:
- results = paginator.page(page)
+ results = paginator.page(cur_page_nb)
except (EmptyPage, InvalidPage):
results = paginator.page(paginator.num_pages)
return render_to_response("egonomy_all_pictures.html",
- {'results':results, 'nb_pages':paginator.num_pages, 'page':page},
+ {'results':results, 'nb_pages':paginator.num_pages, 'cur_page_nb':cur_page_nb},
+ context_instance=RequestContext(request))
+
+
+def all_fragments(request):
+
+ # Get the cur_page_nb number parameter if possible
+ cur_page_nb = request.GET.get("page") or 1
+ cur_page_nb = int(cur_page_nb)
+
+ frg_list = Fragment.objects.all().order_by('pk')
+ nb = 32
+ paginator = Paginator(frg_list, nb)
+ try:
+ results = paginator.page(cur_page_nb)
+ except (EmptyPage, InvalidPage):
+ results = paginator.page(paginator.num_pages)
+
+ return render_to_response("egonomy_all_fragments.html",
+ {'results':results, 'nb_pages':paginator.num_pages, 'cur_page_nb':cur_page_nb},
context_instance=RequestContext(request))