forked from CGM_Public/pretix_original
Allow to manually exclude quotas from calendar availability
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.2.3 on 2021-05-27 09:50
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('pretixbase', '0189_auto_20210525_1311'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='quota',
|
||||||
|
name='ignore_for_event_availability',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -260,7 +260,9 @@ class EventMixin:
|
|||||||
Prefetch(
|
Prefetch(
|
||||||
'quotas',
|
'quotas',
|
||||||
to_attr='active_quotas',
|
to_attr='active_quotas',
|
||||||
queryset=Quota.objects.using(settings.DATABASE_REPLICA).annotate(
|
queryset=Quota.objects.using(settings.DATABASE_REPLICA).filter(
|
||||||
|
ignore_for_event_availability=False
|
||||||
|
).annotate(
|
||||||
active_items=Subquery(sq_active_item, output_field=models.TextField()),
|
active_items=Subquery(sq_active_item, output_field=models.TextField()),
|
||||||
active_variations=Subquery(sq_active_variation, output_field=models.TextField()),
|
active_variations=Subquery(sq_active_variation, output_field=models.TextField()),
|
||||||
).exclude(
|
).exclude(
|
||||||
|
|||||||
@@ -1517,6 +1517,14 @@ class Quota(LoggedModel):
|
|||||||
verbose_name=_("Variations")
|
verbose_name=_("Variations")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ignore_for_event_availability = models.BooleanField(
|
||||||
|
verbose_name=_('Ignore this quota when determining event availability'),
|
||||||
|
help_text=_('If you enable this, this quota will be ignored when determining event availability in your event calendar. '
|
||||||
|
'This is useful e.g. for merchandise that is added to each event but should not stop the event from being shown '
|
||||||
|
'as sold out.'),
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
close_when_sold_out = models.BooleanField(
|
close_when_sold_out = models.BooleanField(
|
||||||
verbose_name=_('Close this quota permanently once it is sold out'),
|
verbose_name=_('Close this quota permanently once it is sold out'),
|
||||||
help_text=_('If you enable this, when the quota is sold out once, no more tickets will be sold, '
|
help_text=_('If you enable this, when the quota is sold out once, no more tickets will be sold, '
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ class QuotaForm(I18nModelForm):
|
|||||||
'subevent',
|
'subevent',
|
||||||
'close_when_sold_out',
|
'close_when_sold_out',
|
||||||
'release_after_exit',
|
'release_after_exit',
|
||||||
|
'ignore_for_event_availability',
|
||||||
]
|
]
|
||||||
field_classes = {
|
field_classes = {
|
||||||
'subevent': SafeModelChoiceField,
|
'subevent': SafeModelChoiceField,
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
<legend>{% trans "Advanced options" %}</legend>
|
<legend>{% trans "Advanced options" %}</legend>
|
||||||
{% bootstrap_field form.close_when_sold_out layout="control" %}
|
{% bootstrap_field form.close_when_sold_out layout="control" %}
|
||||||
{% bootstrap_field form.release_after_exit layout="control" %}
|
{% bootstrap_field form.release_after_exit layout="control" %}
|
||||||
|
{% bootstrap_field form.ignore_for_event_availability layout="control" %}
|
||||||
</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">
|
||||||
|
|||||||
@@ -66,6 +66,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<strong><a href="{% url "control:event.items.quotas.show" organizer=request.event.organizer.slug event=request.event.slug quota=q.id %}">{{ q.name }}</a></strong>
|
<strong><a href="{% url "control:event.items.quotas.show" organizer=request.event.organizer.slug event=request.event.slug quota=q.id %}">{{ q.name }}</a></strong>
|
||||||
|
{% if q.ignore_for_event_availability %}
|
||||||
|
<span class="fa fa-eye-slash text-muted" data-toggle="tooltip" title="{% trans "Ignore this quota when determining event availability" %}"></span>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -442,6 +442,7 @@
|
|||||||
{% bootstrap_field form.size layout="control" %}
|
{% bootstrap_field form.size layout="control" %}
|
||||||
{% bootstrap_field form.itemvars layout="control" %}
|
{% bootstrap_field form.itemvars layout="control" %}
|
||||||
{% bootstrap_field form.release_after_exit layout="control" %}
|
{% bootstrap_field form.release_after_exit layout="control" %}
|
||||||
|
{% bootstrap_field form.ignore_for_event_availability layout="control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -470,6 +471,7 @@
|
|||||||
{% bootstrap_field formset.empty_form.size layout="control" %}
|
{% bootstrap_field formset.empty_form.size layout="control" %}
|
||||||
{% bootstrap_field formset.empty_form.itemvars layout="control" %}
|
{% bootstrap_field formset.empty_form.itemvars layout="control" %}
|
||||||
{% bootstrap_field formset.empty_form.release_after_exit layout="control" %}
|
{% bootstrap_field formset.empty_form.release_after_exit layout="control" %}
|
||||||
|
{% bootstrap_field formset.empty_form.ignore_for_event_availability layout="control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endescapescript %}
|
{% endescapescript %}
|
||||||
|
|||||||
@@ -221,6 +221,7 @@
|
|||||||
{% bootstrap_field form.size layout="control" %}
|
{% bootstrap_field form.size layout="control" %}
|
||||||
{% bootstrap_field form.itemvars layout="control" %}
|
{% bootstrap_field form.itemvars layout="control" %}
|
||||||
{% bootstrap_field form.release_after_exit layout="control" %}
|
{% bootstrap_field form.release_after_exit layout="control" %}
|
||||||
|
{% bootstrap_field form.ignore_for_event_availability layout="control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -249,6 +250,7 @@
|
|||||||
{% bootstrap_field formset.empty_form.size layout="control" %}
|
{% bootstrap_field formset.empty_form.size layout="control" %}
|
||||||
{% bootstrap_field formset.empty_form.itemvars layout="control" %}
|
{% bootstrap_field formset.empty_form.itemvars layout="control" %}
|
||||||
{% bootstrap_field formset.empty_form.release_after_exit layout="control" %}
|
{% bootstrap_field formset.empty_form.release_after_exit layout="control" %}
|
||||||
|
{% bootstrap_field formset.empty_form.ignore_for_event_availability layout="control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endescapescript %}
|
{% endescapescript %}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@
|
|||||||
{% bootstrap_field form.size layout="control" %}
|
{% bootstrap_field form.size layout="control" %}
|
||||||
{% bootstrap_field form.itemvars layout="control" %}
|
{% bootstrap_field form.itemvars layout="control" %}
|
||||||
{% bootstrap_field form.release_after_exit layout="control" %}
|
{% bootstrap_field form.release_after_exit layout="control" %}
|
||||||
|
{% bootstrap_field form.ignore_for_event_availability layout="control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -112,6 +113,7 @@
|
|||||||
{% bootstrap_field formset.empty_form.size layout="control" %}
|
{% bootstrap_field formset.empty_form.size layout="control" %}
|
||||||
{% bootstrap_field formset.empty_form.itemvars layout="control" %}
|
{% bootstrap_field formset.empty_form.itemvars layout="control" %}
|
||||||
{% bootstrap_field formset.empty_form.release_after_exit layout="control" %}
|
{% bootstrap_field formset.empty_form.release_after_exit layout="control" %}
|
||||||
|
{% bootstrap_field formset.empty_form.ignore_for_event_availability layout="control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endescapescript %}
|
{% endescapescript %}
|
||||||
|
|||||||
Reference in New Issue
Block a user