New implementation of sales channels (#4111)

Co-authored-by: Martin Gross <gross@rami.io>
This commit is contained in:
Raphael Michel
2024-06-30 19:24:30 +02:00
committed by GitHub
parent 95511b0330
commit 4fb5c6bef0
174 changed files with 2902 additions and 616 deletions

View File

@@ -43,7 +43,6 @@ from pretix.control.permissions import (
)
from pretix.helpers.models import modelcopy
from ...base.channels import get_all_sales_channels
from ...helpers.compat import CompatDeleteView
from . import CreateView, PaginationMixin, UpdateView
@@ -190,11 +189,14 @@ class DiscountList(PaginationMixin, ListView):
template_name = 'pretixcontrol/items/discounts.html'
def get_queryset(self):
return self.request.event.discounts.prefetch_related('condition_limit_products')
return self.request.event.discounts.prefetch_related('condition_limit_products', 'limit_sales_channels')
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
ctx['sales_channels'] = get_all_sales_channels()
ctx['sales_channels'] = [
c for c in self.request.organizer.sales_channels.all()
if c.type_instance.discounts_supported
]
return ctx