Add Item.allow_waitinglist

This commit is contained in:
Raphael Michel
2019-07-29 16:27:27 +02:00
parent c60d1c8a5d
commit ad8f109e77
9 changed files with 44 additions and 4 deletions
+8 -1
View File
@@ -75,6 +75,8 @@ generate_tickets boolean If ``false``, t
non-admission or add-on product, regardless of event
settings. If this is ``null``, regular ticketing
rules apply.
allow_waitinglist boolean If ``false``, no waiting list will be shown for this
product when it is sold out.
show_quota_left boolean Publicly show how many tickets are still available.
If this is ``null``, the event default is used.
has_variations boolean Shows whether or not this item has variations.
@@ -149,7 +151,7 @@ bundles list of objects Definition of b
.. versionchanged:: 3.0
The ``show_quota_left`` and ``hidden_if_available`` attributes have been added.
The ``show_quota_left``, ``allow_waitinglist``, and ``hidden_if_available`` attributes have been added.
Notes
-----
@@ -217,6 +219,7 @@ Endpoints
"checkin_attention": false,
"has_variations": false,
"generate_tickets": null,
"allow_waitinglist": true,
"show_quota_left": null,
"require_approval": false,
"require_bundling": false,
@@ -306,6 +309,7 @@ Endpoints
"hide_without_voucher": false,
"allow_cancel": true,
"generate_tickets": null,
"allow_waitinglist": true,
"show_quota_left": null,
"min_per_order": null,
"max_per_order": null,
@@ -380,6 +384,7 @@ Endpoints
"hide_without_voucher": false,
"allow_cancel": true,
"generate_tickets": null,
"allow_waitinglist": true,
"show_quota_left": null,
"min_per_order": null,
"max_per_order": null,
@@ -443,6 +448,7 @@ Endpoints
"min_per_order": null,
"max_per_order": null,
"generate_tickets": null,
"allow_waitinglist": true,
"show_quota_left": null,
"checkin_attention": false,
"has_variations": true,
@@ -533,6 +539,7 @@ Endpoints
"require_voucher": false,
"hide_without_voucher": false,
"generate_tickets": null,
"allow_waitinglist": true,
"show_quota_left": null,
"allow_cancel": true,
"min_per_order": null,
+1 -1
View File
@@ -119,7 +119,7 @@ class ItemSerializer(I18nAwareModelSerializer):
'require_voucher', 'hide_without_voucher', 'allow_cancel', 'require_bundling',
'min_per_order', 'max_per_order', 'checkin_attention', 'has_variations', 'variations',
'addons', 'bundles', 'original_price', 'require_approval', 'generate_tickets',
'show_quota_left', 'hidden_if_available')
'show_quota_left', 'hidden_if_available', 'allow_waitinglist')
read_only_fields = ('has_variations', 'picture')
def get_serializer_context(self):
@@ -0,0 +1,21 @@
# Generated by Django 2.2.1 on 2019-07-29 14:22
import django.db.models.deletion
from django.db import migrations, models
import pretix.base.models.fields
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0130_auto_20190729_1311'),
]
operations = [
migrations.AddField(
model_name='item',
name='allow_waitinglist',
field=models.BooleanField(default=True),
),
]
+5
View File
@@ -311,6 +311,11 @@ class Item(LoggedModel):
verbose_name=_("Generate tickets"),
blank=True, null=True,
)
allow_waitinglist = models.BooleanField(
verbose_name=_("Show a waiting list for this ticket"),
help_text=_("This will only work of waiting lists are enabled for this event."),
default=True
)
show_quota_left = models.NullBooleanField(
verbose_name=_("Show number of tickets left"),
help_text=_("Publicly show how many tickets are still available."),
+1
View File
@@ -437,6 +437,7 @@ class ItemUpdateForm(I18nModelForm):
'require_approval',
'hide_without_voucher',
'allow_cancel',
'allow_waitinglist',
'max_per_order',
'min_per_order',
'checkin_attention',
@@ -40,6 +40,7 @@
{% bootstrap_field form.hide_without_voucher layout="control" %}
{% bootstrap_field form.require_bundling layout="control" %}
{% bootstrap_field form.allow_cancel layout="control" %}
{% bootstrap_field form.allow_waitinglist layout="control" %}
</fieldset>
{% for v in formsets.values %}
<fieldset>
@@ -3,7 +3,7 @@
{% if avail <= 10 %}
<div class="col-md-2 col-xs-6 availability-box gone">
<strong>{% trans "SOLD OUT" %}</strong>
{% if event.settings.waiting_list_enabled %}
{% if event.settings.waiting_list_enabled and item.allow_waitinglist %}
<br/>
<a href="{% eventurl event "presale:event.waitinglist" cart_namespace=cart_namespace|default_if_none:"" %}?item={{ item.pk }}{% if var %}&var={{ var.pk }}{% endif %}{% if subevent %}&subevent={{ subevent.pk }}{% endif %}">
<span class="fa fa-plus-circle"></span>
@@ -17,7 +17,7 @@
<span class="fa fa-info-circle" data-toggle="tooltip"
title="{% trans "All remaining products are reserved but might become available again." %}"></span>
</strong>
{% if event.settings.waiting_list_enabled %}
{% if event.settings.waiting_list_enabled and item.allow_waitinglist %}
<br/>
<a href="{% eventurl event "presale:event.waitinglist" cart_namespace=cart_namespace|default_if_none:"" %}?item={{ item.pk }}{% if var %}&var={{ var.pk }}{% endif %}{% if subevent %}&subevent={{ subevent.pk }}{% endif %}">
<span class="fa fa-plus-circle"></span>
+4
View File
@@ -81,6 +81,10 @@ class WaitingView(EventViewMixin, FormView):
messages.error(request, _("We could not identify the product you selected."))
return redirect(self.get_index_url())
if not self.item_and_variation[0].allow_waitinglist:
messages.error(request, _("The waiting list is disabled for this product."))
return redirect(self.get_index_url())
self.subevent = None
if request.event.has_subevents:
if 'subevent' in request.GET:
+1
View File
@@ -225,6 +225,7 @@ TEST_ITEM_RES = {
"admission": False,
"position": 0,
"generate_tickets": None,
"allow_waitinglist": True,
"picture": None,
"available_from": None,
"available_until": None,