mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Refs #85 -- Do not sell tickets that are marked as inactive
This commit is contained in:
@@ -80,6 +80,9 @@ def check_positions(event, dt, positions, quotas_locked):
|
||||
err = None
|
||||
|
||||
for i, cp in enumerate(positions):
|
||||
if not cp.item.active:
|
||||
err = err or error_messages['unavailable']
|
||||
continue
|
||||
quotas = list(cp.item.quotas.all()) if cp.variation is None else list(cp.variation.quotas.all())
|
||||
if cp.expires >= dt:
|
||||
# Other checks are not necessary
|
||||
|
||||
@@ -208,7 +208,7 @@ class CartAdd(EventViewMixin, CartActionMixin, View):
|
||||
# Fetch all quotas. If there are no quotas, this item is not allowed to be sold.
|
||||
quotas = list(item.quotas.all()) if variation is None else list(variation.quotas.all())
|
||||
|
||||
if price is False or len(quotas) == 0:
|
||||
if price is False or len(quotas) == 0 or not item.active:
|
||||
self.error_message(self.error_messages['unavailable'])
|
||||
continue
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ class EventIndex(EventViewMixin, CartDisplayMixin, TemplateView):
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
# Fetch all items
|
||||
items = self.request.event.items.all().select_related(
|
||||
items = self.request.event.items.all().filter(
|
||||
active=True
|
||||
).select_related(
|
||||
'category', # for re-grouping
|
||||
).prefetch_related(
|
||||
'properties', # for .get_all_available_variations()
|
||||
|
||||
Reference in New Issue
Block a user