raise Http404
model = models.Book
+ shelf_is_set = any(tag.category == 'set' for tag in tags)
theme_is_set = any(tag.category == 'theme' for tag in tags)
if theme_is_set:
model = models.Fragment
-
+
extra_where = 'NOT catalogue_tag.category = "set"'
related_tags = models.Tag.objects.related_for_model(tags, model, counts=True, extra={'where': [extra_where]})
categories = split_tags(related_tags)
queryset_or_model=model,
tags=tags,
template_name='catalogue/tagged_object_list.html',
- extra_context = {'categories': categories },
+ extra_context = {'categories': categories, 'shelf_is_set': shelf_is_set },
)
<h1>{% title_from_tags tags %}</h1>
{% breadcrumbs tags %}
+ {% if shelf_is_set and not object_list %}
+ <div id="books-list">
+ <h2>Twoja półka jest pusta</h2>
+ <p>Możesz wrzucić książkę na półkę, wchodząc na stronę danej lektury i klikając na przycisk „Na półkę!”.</p>
+ </div>
+ {% else %}
{% autopaginate object_list 10 %}
<div id="books-list">
{% with tags|last as last_tag %}
</div>
<div class="clearboth"></div>
</div>
+ {% endif %}
<div id="set-window">
<div class="header"><a href="#" class="jqmClose">Zamknij</a></div>
<div class="target">