From b381ee00f38c9b3db5012d9e46155e65a8ebb9ea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20St=C4=99pniowski?= Date: Sat, 13 Sep 2008 08:45:14 +0200 Subject: [PATCH] Changed generation of title from tags. --- apps/catalogue/templatetags/catalogue_tags.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/apps/catalogue/templatetags/catalogue_tags.py b/apps/catalogue/templatetags/catalogue_tags.py index 36e80d273..537e3ec56 100644 --- a/apps/catalogue/templatetags/catalogue_tags.py +++ b/apps/catalogue/templatetags/catalogue_tags.py @@ -37,6 +37,23 @@ def capfirst(text): return '' + +def simple_title(tags): + mapping = { + 'author': u'Autor', + 'theme': u'Motyw', + 'epoch': u'Epoka', + 'genre': u'Gatunek', + 'kind': u'Rodzaj', + 'set': u'Półka', + } + + title = [] + for tag in tags: + title.append("%s: %s." % (mapping[tag.category], tag.name)) + return ' '.join(title) + + @register.simple_tag def title_from_tags(tags): def split_tags(tags): @@ -45,6 +62,9 @@ def title_from_tags(tags): result[tag.category] = tag return result + # TODO: Remove this after adding flection mechanism + return simple_title(tags) + class Flection(object): def get_case(self, name, flection): return name -- 2.20.1