From 0854610e6f1a717ce100c96f7ebf36cbb3478a5c Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 24 Jan 2012 16:51:33 +0100 Subject: [PATCH] more box fixes --- apps/catalogue/models.py | 2 +- apps/catalogue/templatetags/catalogue_tags.py | 9 ++++++++ .../templates/catalogue/book_short.html | 22 +++++++++---------- .../templates/catalogue/book_wide.html | 2 +- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 03cf0c891..a94411191 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -788,7 +788,7 @@ class Book(models.Model): tags = split_tags(tags) for category in tags: rel['tags'][category] = [ - (t.name, t.get_absolute_url()) for t in tags[category]] + (t.name, t.slug) for t in tags[category]] for media_format in BookMedia.formats: rel['media'][media_format] = self.has_media(media_format) diff --git a/apps/catalogue/templatetags/catalogue_tags.py b/apps/catalogue/templatetags/catalogue_tags.py index 542f1cde2..c2d7dd6d5 100644 --- a/apps/catalogue/templatetags/catalogue_tags.py +++ b/apps/catalogue/templatetags/catalogue_tags.py @@ -292,6 +292,7 @@ def book_wide(context, book): return { 'book': book, + 'main_link': reverse('book_text', args=[book.slug]), 'related': book.related_info(), 'extra_info': book.get_extra_info_value(), 'hide_about': hide_about, @@ -305,6 +306,7 @@ def book_wide(context, book): def book_short(context, book): return { 'book': book, + 'main_link': book.get_absolute_url(), 'related': book.related_info(), 'request': context.get('request'), } @@ -356,6 +358,13 @@ def related_books(book, limit=6): } +@register.simple_tag +def tag_url(category, slug): + return reverse('catalogue.views.tagged_object_list', args=[ + '/'.join((Tag.categories_dict[category], slug)) + ]) + + @register.filter @stringfilter def removewholetags(value, tags): diff --git a/wolnelektury/templates/catalogue/book_short.html b/wolnelektury/templates/catalogue/book_short.html index a6d3028d1..9eae96fd8 100644 --- a/wolnelektury/templates/catalogue/book_short.html +++ b/wolnelektury/templates/catalogue/book_short.html @@ -1,11 +1,11 @@ {% load i18n %} -{% load social_tags %} +{% load catalogue_tags social_tags %} {% load thumbnail %}
- + {% if book.cover %}
- {% for name, url in related.tags.author %} - {{ name }}{% if not forloop.last %}, + {% for name, slug in related.tags.author %} + {{ name }}{% if not forloop.last %}, {% endif %}{% endfor %}{% for title, slug in related.parents %}, {{ title }} {% endfor %}
- +
{% spaceless %} {% trans "Epoch" %}:  - {% for name, url in related.tags.epoch %} - {{ name }} + {% for name, slug in related.tags.epoch %} + {{ name }} {% endfor %} {% trans "Kind" %}:  - {% for name, url in related.tags.kind %} - {{ name }} + {% for name, slug in related.tags.kind %} + {{ name }} {% endfor %} {% trans "Genre" %}:  - {% for name, url in related.tags.genre %} - {{ name }} + {% for name, slug in related.tags.genre %} + {{ name }} {% endfor %} diff --git a/wolnelektury/templates/catalogue/book_wide.html b/wolnelektury/templates/catalogue/book_wide.html index dfe57b656..2ea5555a3 100644 --- a/wolnelektury/templates/catalogue/book_wide.html +++ b/wolnelektury/templates/catalogue/book_wide.html @@ -15,7 +15,7 @@
-- 2.20.1