Merge pull request #1006 from pretix/empty_vouchers

Allow to show all vouchers with empty tags
This commit is contained in:
Raphael Michel
2018-11-05 10:35:22 +01:00
committed by GitHub
2 changed files with 15 additions and 5 deletions

View File

@@ -796,7 +796,10 @@ class VoucherFilterForm(FilterForm):
if fdata.get('tag'):
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'):
s = fdata.get('qm')

View File

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