X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/e0de41ae1e67c230ad1e67f34f6f4f76e53d7234..032889045439986dc8506267cbb68643473970ff:/apps/catalogue/templatetags/catalogue_tags.py diff --git a/apps/catalogue/templatetags/catalogue_tags.py b/apps/catalogue/templatetags/catalogue_tags.py index 41be051f2..504ee69d7 100644 --- a/apps/catalogue/templatetags/catalogue_tags.py +++ b/apps/catalogue/templatetags/catalogue_tags.py @@ -11,6 +11,7 @@ from django.utils.encoding import smart_str from django.core.urlresolvers import reverse from django.contrib.auth.forms import UserCreationForm, AuthenticationForm from django.db.models import Q +from django.conf import settings register = template.Library() @@ -138,7 +139,11 @@ def authentication_form(): def breadcrumbs(tags, search_form=True): from catalogue.forms import SearchForm context = {'tag_list': tags} - if search_form and len(tags) < 6: + try: + max_tag_list = settings.MAX_TAG_LIST + except AttributeError: + max_tag_list = -1 + if search_form and (max_tag_list == -1 or len(tags) < max_tag_list): context['search_form'] = SearchForm(tags=tags) return context @@ -182,10 +187,10 @@ class CatalogueURLNode(Node): else: tags_to_remove.append(tag) - tag_slugs = [tag.slug for tag in tags_to_add] + tag_slugs = [tag.url_chunk for tag in tags_to_add] for tag in tags_to_remove: try: - tag_slugs.remove(tag.slug) + tag_slugs.remove(tag.url_chunk) except KeyError: pass