From 04f567d3dcf63ec88484ba25a178c6eb336ea04e Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Wed, 10 Feb 2016 14:02:10 +0100 Subject: [PATCH] #8 tagged object list for audiobooks --- src/catalogue/models/tag.py | 9 +- .../templates/catalogue/inline_tag_list.html | 42 ++++---- .../templates/catalogue/plain_list.html | 2 +- .../templates/catalogue/tag_list.html | 4 +- .../catalogue/tagged_object_list.html | 96 +++++++++---------- src/catalogue/templatetags/catalogue_tags.py | 62 ++++++------ src/catalogue/urls.py | 8 +- src/catalogue/views.py | 48 ++++++---- 8 files changed, 138 insertions(+), 133 deletions(-) diff --git a/src/catalogue/models/tag.py b/src/catalogue/models/tag.py index 57935f8fb..06aa7a1d5 100644 --- a/src/catalogue/models/tag.py +++ b/src/catalogue/models/tag.py @@ -9,6 +9,7 @@ from django.db import models from django.db.models import permalink from django.dispatch import Signal from django.utils.translation import ugettext_lazy as _ + from newtagging.models import TagBase from ssify import flush_ssi_includes @@ -48,7 +49,9 @@ class Tag(TagBase): after_change = Signal(providing_args=['instance', 'languages']) class UrlDeprecationWarning(DeprecationWarning): - pass + def __init__(self, tags=None): + super(Tag.UrlDeprecationWarning, self).__init__() + self.tags = tags categories_rev = { 'autor': 'author', @@ -189,9 +192,7 @@ class Tag(TagBase): e.ambiguous_slugs = ambiguous_slugs raise e if deprecated: - e = Tag.UrlDeprecationWarning() - e.tags = real_tags - raise e + raise Tag.UrlDeprecationWarning(tags=real_tags) return real_tags else: return TagBase.get_tag_list(tags) diff --git a/src/catalogue/templates/catalogue/inline_tag_list.html b/src/catalogue/templates/catalogue/inline_tag_list.html index 920b55500..cf53e2d73 100755 --- a/src/catalogue/templates/catalogue/inline_tag_list.html +++ b/src/catalogue/templates/catalogue/inline_tag_list.html @@ -1,37 +1,29 @@ {% load i18n %} {% load catalogue_tags %} - {% if choices %} - {% if category_choices %} - - {% endif %} - {% if tags %} + +{% if choices %} + {% if category_choices %} - {% endif %} - {% else %} - {% if tags %} -