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(
|
||||
'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_variations=Subquery(sq_active_variation, output_field=models.TextField()),
|
||||
).exclude(
|
||||
|
||||
@@ -1517,6 +1517,14 @@ class Quota(LoggedModel):
|
||||
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(
|
||||
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, '
|
||||
|
||||
Reference in New Issue
Block a user