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}
- if search_form:
+ if search_form and len(tags) < 6:
context['search_form'] = SearchForm(tags=tags)
return context
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:
margin: 0;
padding: 0;
list-style: none;
- display: inline;
+ display: block;
+ float: left;
}
#search-form li.category, #search-form li.book-title {
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
+ margin-right: 0.25em;
}
#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 %}
- <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 %}
</ol>
+ <div class="clearboth"></div>
</form>
\ No newline at end of file