@register.inclusion_tag('catalogue/plain_list.html', takes_context=True)
def plain_list(context, object_list, with_initials=True, by_author=False, choice=None, book=None, gallery=False,
- paged=True):
+ paged=True, initial_blocks=False):
names = [('', [])]
last_initial = None
+ if len(object_list) < settings.CATALOGUE_MIN_INITIALS and not by_author:
+ with_initials = False
+ initial_blocks = False
for obj in object_list:
if with_initials:
if by_author:
fragment_count = fragments.count()
fragment = fragments[randint(0, fragment_count - 1)] if fragment_count else None
return fragment.pk if fragment is not None else None
+
+
+@register.filter
+def strip_tag(html, tag_name):
+ # docelowo może być warto zainstalować BeautifulSoup do takich rzeczy
+ import re
+ return re.sub(r"<.?%s\b[^>]*>" % tag_name, "", html)