SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit afb60ebe authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Improve subsidy list

parent 7108a6ee
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@ $(document).ready(function($) {
<a href="{% url 'finances:subsidies' %}"><i class="fa fa-sort-desc"></i></a>
{% endif %}
</th>
<th>Date
<th>From date
{% if request.GET.ordering != 'asc' %}
<a href="?order_by=date&ordering=asc"><i class="fa fa-sort-asc"></i></a>
{% else %}
......@@ -65,6 +65,18 @@ $(document).ready(function($) {
<a href="{% url 'finances:subsidies' %}"><i class="fa fa-sort-desc"></i></a>
{% endif %}
</th>
<th>Until
{% if request.GET.ordering != 'asc' %}
<a href="?order_by=until&ordering=asc"><i class="fa fa-sort-asc"></i></a>
{% else %}
<a href="{% url 'finances:subsidies' %}"><i class="fa fa-sort-asc"></i></a>
{% endif %}
{% if request.GET.ordering != 'desc' %}
<a href="?order_by=until&ordering=desc"><i class="fa fa-sort-desc"></i></a>
{% else %}
<a href="{% url 'finances:subsidies' %}"><i class="fa fa-sort-desc"></i></a>
{% endif %}
</th>
</tr>
</thead>
<tbody>
......@@ -74,10 +86,11 @@ $(document).ready(function($) {
<td>{{ subsidy.get_subsidy_type_display }}</td>
<td>{% if subsidy.amount_publicly_shown or perms.scipost.can_manage_subsidies %}&euro;{{ subsidy.amount }}{% else %}-{% endif %}</td>
<td>{{ subsidy.date }}</td>
<td>{{ subsidy.date_until }}</td>
</tr>
{% empty %}
<tr>
<td colspan="4">No Subsidy found</td>
<td colspan="5">No Subsidy found</td>
</tr>
{% endfor %}
</tbody>
......
......@@ -72,6 +72,8 @@ class SubsidyListView(ListView):
qs = qs.filter(amount_publicly_shown=True).order_by('amount')
elif order_by == 'date':
qs = qs.order_by('date')
elif order_by == 'until':
qs = qs.order_by('date_until')
if ordering == 'desc':
qs = qs.reverse()
return qs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment