X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/b2d342589a7889a3b096e7192453d53bd28eed7d..1ca64302e8447c9715ab42dd1a33075f312e6059:/src/catalogue/models/tag.py diff --git a/src/catalogue/models/tag.py b/src/catalogue/models/tag.py index 4a7be0247..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) @@ -219,7 +220,7 @@ class Tag(TagBase): lang = getattr(tag_name, 'lang', settings.LANGUAGE_CODE) tag_sort_key = tag_name if category == 'author': - tag_sort_key = tag_name.last_name + tag_sort_key = ' '.join((tag_name.last_name,) + tag_name.first_names) tag_name = tag_name.readable() if lang == settings.LANGUAGE_CODE: # Allow creating new tag, if it's in default language.