+{%load pgfilters%}
<html>
<head>
-<title>Put Title Here</title>
+<title>{{title}}</title>
</head>
<body>
-<h1>Put Title Here</h1>
+<h1>{{title}}</h1>
{%for m in messages%}
{%ifchanged m.date.date%}
{%if not forloop.first%}
<h3>{{m.date.date}}</h3>
<ul>
{%endifchanged%}
- <li><a href="/test/{{m.id}}/">{{m.subject}}</a> ({{m.date.time|time:"H:i"}})</li>
+ <li><a href="/message-id/{{m.messageid}}/">{{m.subject}}</a> ({{m.date.time|time:"H:i:s"}} from {{m.mailfrom|hidemail}})</li>
{%if forloop.last%}
</ul>
{%endif%}
{%endfor%}
{%with messages|last as lastmsg%}
-<a href="/{{list.listname}}/since/{{lastmsg.id}}/">Next</a>
+<a href="/{{list.listname}}/since/{{lastmsg.messageid}}/">Next</a>
{%endwith%}
</body>
</html>
from models import *
-def render_datelist_from(request, l, d):
+def render_datelist_from(request, l, d, title):
mlist = Message.objects.select_related().filter(date__gte=d).extra(where=["threadid IN (SELECT threadid FROM list_threads WHERE listid=%s)" % l.listid]).order_by('date')[:200]
return render_to_response('datelist.html', {
'list': l,
'messages': list(mlist),
+ 'title': title,
})
-def datelistsince(request, listname, msgnum):
+def datelistsince(request, listname, msgid):
l = get_object_or_404(List, listname=listname)
- msg = get_object_or_404(Message, pk=msgnum)
- return render_datelist_from(request, l, msg.date)
+ msg = get_object_or_404(Message, messageid=msgid)
+ return render_datelist_from(request, l, msg.date, "%s since %s" % (l.listname, msg.date.strftime("%Y-%m-%d %H:%M:%S")))
def datelist(request, listname, year, month):
- listid = get_object_or_404(List, listname=listname)
- return render_datelist_from(request, listid, datetime(int(year), int(month), 1))
+ l = get_object_or_404(List, listname=listname)
+ d = datetime(int(year), int(month), 1)
+ return render_datelist_from(request, l, d, "%s - %s %s" % (l.listname, d.strftime("%B"), d.year))
def attachment(request, attid):
(r'^test/oldsite/([^/]+)/$', 'archives.mailarchives.views.oldsite'),
(r'^([\w-]+)/(\d+)-(\d+)/$', 'archives.mailarchives.views.datelist'),
- (r'^([\w-]+)/since/(\d+)/$', 'archives.mailarchives.views.datelistsince'),
+ (r'^([\w-]+)/since/([^/]+)/$', 'archives.mailarchives.views.datelistsince'),
(r'^attachment/(\d+)/$', 'archives.mailarchives.views.attachment'),
)