forked from CGM_Public/pretix_original
Added "comments" and "tags" to vouchers
This commit is contained in:
25
src/pretix/base/migrations/0023_auto_20160601_1039.py
Normal file
25
src/pretix/base/migrations/0023_auto_20160601_1039.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.6 on 2016-06-01 10:39
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pretixbase', '0022_merge'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='voucher',
|
||||||
|
name='comment',
|
||||||
|
field=models.TextField(blank=True, help_text='The text entered in this field will not be visible to the user and is available for your convenience.', verbose_name='Comment'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='voucher',
|
||||||
|
name='tag',
|
||||||
|
field=models.CharField(blank=True, help_text='You can use this field to group multiple vouchers together. If you enter the same value for multiple vouchers, you can get statistics on how many of them have been redeemed etc.', max_length=255, verbose_name='Tag'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -101,6 +101,18 @@ class Voucher(LoggedModel):
|
|||||||
"If enabled, the voucher is valid for any product affected by this quota."
|
"If enabled, the voucher is valid for any product affected by this quota."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
tag = models.CharField(
|
||||||
|
max_length=255,
|
||||||
|
verbose_name=_("Tag"),
|
||||||
|
blank=True,
|
||||||
|
help_text=_("You can use this field to group multiple vouchers together. If you enter the same value for "
|
||||||
|
"multiple vouchers, you can get statistics on how many of them have been redeemed etc.")
|
||||||
|
)
|
||||||
|
comment = models.TextField(
|
||||||
|
blank=True, verbose_name=_("Comment"),
|
||||||
|
help_text=_("The text entered in this field will not be visible to the user and is available for your "
|
||||||
|
"convenience.")
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Voucher")
|
verbose_name = _("Voucher")
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ class VoucherForm(I18nModelForm):
|
|||||||
model = Voucher
|
model = Voucher
|
||||||
localized_fields = '__all__'
|
localized_fields = '__all__'
|
||||||
fields = [
|
fields = [
|
||||||
'code', 'valid_until', 'block_quota', 'allow_ignore_quota', 'price'
|
'code', 'valid_until', 'block_quota', 'allow_ignore_quota', 'price', 'tag',
|
||||||
|
'comment'
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|||||||
@@ -20,13 +20,21 @@
|
|||||||
{% bootstrap_field form.allow_ignore_quota layout="horizontal" %}
|
{% bootstrap_field form.allow_ignore_quota layout="horizontal" %}
|
||||||
{% bootstrap_field form.price layout="horizontal" %}
|
{% bootstrap_field form.price layout="horizontal" %}
|
||||||
{% bootstrap_field form.itemvar layout="horizontal" %}
|
{% bootstrap_field form.itemvar layout="horizontal" %}
|
||||||
<div class="alert alert-info">
|
<div class="form-group">
|
||||||
{% blocktrans trimmed %}
|
<div class="col-md-9 col-md-offset-3">
|
||||||
If you choose "any product" for a specific quota and choose to reserve quota for this
|
<div class="controls">
|
||||||
voucher above, the product can still be unavailable to the voucher holder if another quota
|
<div class="alert alert-info">
|
||||||
associated with the product is sold out!
|
{% blocktrans trimmed %}
|
||||||
{% endblocktrans %}
|
If you choose "any product" for a specific quota and choose to reserve quota for this
|
||||||
|
voucher above, the product can still be unavailable to the voucher holder if another quota
|
||||||
|
associated with the product is sold out!
|
||||||
|
{% endblocktrans %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% bootstrap_field form.tag layout="horizontal" %}
|
||||||
|
{% bootstrap_field form.comment layout="horizontal" %}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class="form-group submit-group">
|
<div class="form-group submit-group">
|
||||||
<button type="submit" class="btn btn-primary btn-save">
|
<button type="submit" class="btn btn-primary btn-save">
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
<th>{% trans "Voucher code" %}</th>
|
<th>{% trans "Voucher code" %}</th>
|
||||||
<th>{% trans "Is redeemed" %}</th>
|
<th>{% trans "Is redeemed" %}</th>
|
||||||
<th>{% trans "Expiry" %}</th>
|
<th>{% trans "Expiry" %}</th>
|
||||||
|
<th>{% trans "Tag" %}</th>
|
||||||
<th>{% trans "Product" %}</th>
|
<th>{% trans "Product" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -50,6 +51,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{% if v.redeemed %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</td>
|
<td>{% if v.redeemed %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</td>
|
||||||
<td>{{ v.valid_until|date }}</td>
|
<td>{{ v.valid_until|date }}</td>
|
||||||
|
<td>
|
||||||
|
{{ v.tag }}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if v.item %}
|
{% if v.item %}
|
||||||
{{ v.item }}
|
{{ v.item }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.urlresolvers import resolve, reverse
|
from django.core.urlresolvers import resolve, reverse
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
from django.db.models import Q
|
||||||
from django.http import Http404, HttpResponseRedirect
|
from django.http import Http404, HttpResponseRedirect
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
|
from django.views.generic import CreateView, DeleteView, ListView, UpdateView
|
||||||
@@ -21,11 +22,10 @@ class VoucherList(EventPermissionRequiredMixin, ListView):
|
|||||||
qs = self.request.event.vouchers.all().select_related('item')
|
qs = self.request.event.vouchers.all().select_related('item')
|
||||||
if self.request.GET.get("search", "") != "":
|
if self.request.GET.get("search", "") != "":
|
||||||
s = self.request.GET.get("search", "")
|
s = self.request.GET.get("search", "")
|
||||||
qs = qs.filter(code__contains=s)
|
qs = qs.filter(Q(code__icontains=s) | Q(tag__icontains=s) | Q(comment__icontains=s))
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class VoucherDelete(EventPermissionRequiredMixin, DeleteView):
|
class VoucherDelete(EventPermissionRequiredMixin, DeleteView):
|
||||||
model = Voucher
|
model = Voucher
|
||||||
template_name = 'pretixcontrol/vouchers/delete.html'
|
template_name = 'pretixcontrol/vouchers/delete.html'
|
||||||
|
|||||||
Reference in New Issue
Block a user