Don't show search form if there are already 6 tags chosen.
def breadcrumbs(tags, search_form=True):
from catalogue.forms import SearchForm
context = {'tag_list': tags}
def breadcrumbs(tags, search_form=True):
from catalogue.forms import SearchForm
context = {'tag_list': tags}
+ if search_form and len(tags) < 6:
context['search_form'] = SearchForm(tags=tags)
return context
context['search_form'] = SearchForm(tags=tags)
return context
def tagged_object_list(request, tags=''):
def tagged_object_list(request, tags=''):
+ # Prevent DoS attacks on our database
+ if len(tags.split('/')) > 6:
+ raise Http404
+
try:
tags = models.Tag.get_tag_list(tags)
except models.Tag.DoesNotExist:
try:
tags = models.Tag.get_tag_list(tags)
except models.Tag.DoesNotExist:
margin: 0;
padding: 0;
list-style: none;
margin: 0;
padding: 0;
list-style: none;
+ display: block;
+ float: left;
}
#search-form li.category, #search-form li.book-title {
}
#search-form li.category, #search-form li.book-title {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
#search-form li.book-title {
}
#search-form li.book-title {
{% for tag in tag_list %}
<li class="category"><a href="{% catalogue_url tag %}">{{ tag }}</a> | <a href="{% catalogue_url tag_list -tag %}">x</a></li>
{% endfor %}
{% for tag in tag_list %}
<li class="category"><a href="{% catalogue_url tag %}">{{ tag }}</a> | <a href="{% catalogue_url tag_list -tag %}">x</a></li>
{% endfor %}
- <li>{{ search_form.q }} {{ search_form.tags }} <input type="submit" value="Szukaj"/></li>
+ {% if search_form %}
+ <li>{{ search_form.q }} {{ search_form.tags }} <input type="submit" value="Szukaj"/></li>
+ {% endif %}
+ <div class="clearboth"></div>
</form>
\ No newline at end of file
</form>
\ No newline at end of file