This commit is contained in:
j 2015-10-15 15:22:03 +02:00
parent c2c6e331d7
commit 61d599f727

View file

@ -44,7 +44,9 @@ def update_keywords():
for a in annotation.models.Annotation.objects.filter(layer='keywords').all().values('value') for a in annotation.models.Annotation.objects.filter(layer='keywords').all().values('value')
]) ])
data = ['<ul>'] data = ['<ul>']
for k in sorted(keywords.keys(), key=lambda k: ox.sort_string('%s %s' % (keywords[k], k)), reverse=True): def s(k):
return ox.sort_string('%s %s' % (10000-keywords[k], k)).lower()
for k in sorted(keywords.keys(), key=s):
data.append('<li>%d <a href="/clip/keywords==%s">%s</a>' %((keywords[k], k.replace(' ', '_'), k))) data.append('<li>%d <a href="/clip/keywords==%s">%s</a>' %((keywords[k], k.replace(' ', '_'), k)))
data.append('</ul>') data.append('</ul>')
t.text = '\n'.join(data) t.text = '\n'.join(data)