sorting, special case for exactly 11 articles

This commit is contained in:
Thomas Renger 2014-04-25 10:51:42 +02:00
parent da246e10dc
commit d12e511c1b
1 changed files with 4 additions and 4 deletions

View File

@ -15,13 +15,13 @@ Zusammenfassung der Woche ab ${week_start.strftime("%d.%m.%Y")}
:</span></dt>
<dd>
<% pc=0 %><ul>
% for p in u.posts[g][week]:
% if pc < 10:
% for p in sorted(u.posts[g][week], key = lambda p:p['date']):
% if pc < 10 or len(u.posts[g][week]) == 11:
<% pc+=1 %><li><a href="${p['url']}">${p['title'] or "[ohne Titel]"}</a></li>
%endif
% endfor
% if len(u.posts[g][week]) > 10:
<li>und ${len(u.posts[g][week])-10} weitere Artikel</li>
% if len(u.posts[g][week]) > 11:
<li>und <a href="${b[2]}">${len(u.posts[g][week])-10} weitere Artikel</a>...</li>
% endif
</ul>
</dd>