Don't generate empty next/prev links when there are no messages
authorMagnus Hagander <magnus@hagander.net>
Wed, 3 Oct 2012 13:15:53 +0000 (15:15 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 3 Oct 2012 13:15:53 +0000 (15:15 +0200)
django/archives/mailarchives/templates/datelist.html

index cb7dca144caf68886c154ff9554bb47e3c7086ed..3c058a9492e57c1c9f1550b6800a02ea80f566d7 100644 (file)
@@ -16,6 +16,7 @@
 </ul>
 {%endif%}
 {%endfor%}
+{%if messages%}
 {%with messages|first as firstmsg%}
 <a href="/list/{{list.listname}}/before/{{firstmsg.shortdate}}">Prev</a>
 {%endwith%}
@@ -23,6 +24,7 @@
 {%with messages|last as lastmsg%}
 <a href="/list/{{list.listname}}/since/{{lastmsg.shortdate}}">Next</a>
 {%endwith%}
+{%endif%}
 
 {%if daysinmonth%}
 <div class="daylinks">Jump to day: {%for d in daysinmonth%}<a href="/list/{{list.listname}}/since/{{yearmonth}}{{d|stringformat:"02d"}}0000/">{{d}}</a> {%endfor%}</div>