Allow to show all vouchers with empty tags

This commit is contained in:
Tobias Kunze
2018-09-08 20:57:43 +02:00
parent 5a29b4bf70
commit 2557a8e4ec
2 changed files with 15 additions and 5 deletions

View File

@@ -796,7 +796,10 @@ class VoucherFilterForm(FilterForm):
if fdata.get('tag'): if fdata.get('tag'):
s = fdata.get('tag').strip() s = fdata.get('tag').strip()
qs = qs.filter(tag__icontains=s) if s == '<>':
qs = qs.filter(Q(tag__isnull=True) | Q(tag=''))
else:
qs = qs.filter(tag__icontains=s)
if fdata.get('qm'): if fdata.get('qm'):
s = fdata.get('qm') s = fdata.get('qm')

View File

@@ -27,10 +27,17 @@
{% for t in tags %} {% for t in tags %}
<tr> <tr>
<td> <td>
<strong><a <strong>
href="{% url "control:event.vouchers" organizer=request.event.organizer.slug event=request.event.slug %}?tag={{ t.tag|urlencode }}"> {% if t.tag %}
{{ t.tag }} <a href="{% url "control:event.vouchers" organizer=request.event.organizer.slug event=request.event.slug %}?tag={{ t.tag|urlencode }}">
</a></strong> <small>({{ t.redeemed }} / {{ t.total }})</small> {{ t.tag }}
</a>
{% else %}
<a href="{% url "control:event.vouchers" organizer=request.event.organizer.slug event=request.event.slug %}?tag={{ '<>'|urlencode }}">
{% trans "Empty tag" %}
</a>
{% endif %}
</strong> <small>({{ t.redeemed }} / {{ t.total }})</small>
</td> </td>
<td> <td>
<div class="progress"> <div class="progress">