# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
import django_filters
+from django.forms.widgets import SelectMultiple
from django.utils.functional import lazy
from django_filters.filters import ModelMultipleChoiceFilter
def tag_filter(dc_tag):
category = Category.objects.get(dc_tag=dc_tag)
return ModelMultipleChoiceFilter(
- queryset=category.tag_set.all(), label=lazy(lambda: category.label, unicode)(), method='filter_by_tag')
+ queryset=category.tag_set.all(),
+ label='',
+ widget=SelectMultiple(attrs={
+ 'class': 'chosen-select',
+ 'data-placeholder': lazy(lambda: category.label, unicode)(),
+ }),
+ method='filter_by_tag')
class DocumentFilterSet(django_filters.FilterSet):
--- /dev/null
+{% extends "catalogue/base.html" %}
+{% load i18n %}
+
+
+{% block content %}
+ <div class="row">
+ <h1 class="col-md-8 col-md-offset-3">{% block header %}{% endblock %}</h1>
+ </div>
+ <div class="row">
+ <div class="col-md-2 col-md-offset-1">
+ <h3>{% trans "Filters" %}</h3>
+ <form action="" method="get">
+ {{ filter_set.form.as_p }}
+ <input type="submit" value="{% trans "Apply" %}" />
+ </form>
+ </div>
+ <div class="col-md-8">
+ {% for doc in filter_set.qs %}
+ {% include "catalogue/resource_box.html" %}
+ {% endfor %}
+ </div>
+ </div>
+{% endblock %}
{% load i18n %}
-{% block inner_content %}
- <h1>{% trans "Finished resources" %}</h1>
- <form action="" method="get">
- {{ filter_set.form.as_p }}
- <input type="submit" />
- </form>
- {% for doc in filter_set.qs %}
- {% include "catalogue/resource_box.html" with link_url='catalogue_html' %}
- {% endfor %}
-{% endblock %}
+{% block header %}{% trans "Finished resources" %}{% endblock %}
-{% extends "catalogue/base.html" %}
+{% extends "catalogue/document_list_base.html" %}
{% load i18n %}
-{% block inner_content %}
- <h1>{% trans "Upcoming resources" %}</h1>
- <form action="" method="get">
- {{ filter_set.form.as_p }}
- <input type="submit" />
- </form>
- {% for doc in filter_set.qs %}
- {% include "catalogue/resource_box.html" with link_url='catalogue_preview' %}
- {% endfor %}
-{% endblock %}
+{% block header %}{% trans "Upcoming resources" %}{% endblock %}
f = DocumentFilterSet(request.GET, queryset=Document.objects.filter(deleted=False).filter(publish_log=None))
return render(request, "catalogue/upcoming.html", {
'filter_set': f,
+ 'link_url': 'catalogue_preview',
})
f = DocumentFilterSet(request.GET, queryset=Document.objects.filter(deleted=False).exclude(publish_log=None))
return render(request, "catalogue/finished.html", {
'filter_set': f,
+ 'link_url': 'catalogue_html',
})