Widget: Allow to filter by product

This commit is contained in:
Raphael Michel
2020-03-06 17:00:26 +01:00
parent 8e9f0f07a1
commit c849276a35
5 changed files with 77 additions and 3 deletions

View File

@@ -51,8 +51,9 @@ def item_group_by_category(items):
)
def get_grouped_items(event, subevent=None, voucher=None, channel='web', require_seat=0):
items = event.items.using(settings.DATABASE_REPLICA).filter_available(channel=channel, voucher=voucher).select_related(
def get_grouped_items(event, subevent=None, voucher=None, channel='web', require_seat=0, base_qs=None):
base_qs = base_qs if base_qs is not None else event.items
items = base_qs.using(settings.DATABASE_REPLICA).filter_available(channel=channel, voucher=voucher).select_related(
'category', 'tax_rule', # for re-grouping
'hidden_if_available',
).prefetch_related(