forked from CGM_Public/pretix_original
Add sub-events and relative date settings (#503)
* Data model * little crud * SubEventItemForm etc * Drop SubEventItem.active, quota editor * Fix failing tests * First frontend stuff * Addons form stuff * Quota calculation * net price display on EventIndex * Add tests, solve some bugs * Correct quota selection in more places, consolidate pricing logic * Fix failing quota tests * Fix TypeError * Add tests for checkout * Fixed a bug in QuotaForm * Prevent immutable cart if a quota was removed from an item * Add tests for pricing * Handle waiting list * Filter in check-in list * Fixed import lost in rebase * Fix waiting list widget * Voucher management * Voucher redemption * Fix broken tests * Add subevents to OrderChangeManager * Create a subevent during event creation * Fix bulk voucher creation * Introduce subevent.active * Copy from for subevents * Show active in list * ICal download for subevents * Check start and end of presale * Failing tests / show cart logic * Test * Rebase migrations * REST API integration of sub-events * Integrate quota calculation into the traditional quota form * Make subevent argument to add_position optional * Log-display foo * pretixdroid and subevents * Filter by subevent * Add more tests * Some mor tests * Rebase fixes * More tests * Relative dates * Restrict selection in relative datetime widgets * Filter subevent list * Re-label has_subevents * Rebase fixes, subevents in calendar view * Performance and caching issues * Refactor calendar templates * Permission tests * Calendar fixes and month selection * subevent selection * Rename subevents to dates * Add tests for calendar views
This commit is contained in:
@@ -35,7 +35,8 @@ class AutoAssign(EventPermissionRequiredMixin, AsyncAction, View):
|
||||
})
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
return self.do(self.request.event.id, self.request.user.id)
|
||||
return self.do(self.request.event.id, self.request.user.id,
|
||||
self.request.POST.get('subevent'))
|
||||
|
||||
|
||||
class WaitingListView(EventPermissionRequiredMixin, ListView):
|
||||
@@ -78,7 +79,9 @@ class WaitingListView(EventPermissionRequiredMixin, ListView):
|
||||
def get_queryset(self):
|
||||
qs = WaitingListEntry.objects.filter(
|
||||
event=self.request.event
|
||||
).select_related('item', 'variation', 'voucher').prefetch_related('item__quotas', 'variation__quotas')
|
||||
).select_related('item', 'variation', 'voucher').prefetch_related(
|
||||
'item__quotas', 'variation__quotas'
|
||||
)
|
||||
|
||||
s = self.request.GET.get("status", "")
|
||||
if s == 's':
|
||||
@@ -90,7 +93,11 @@ class WaitingListView(EventPermissionRequiredMixin, ListView):
|
||||
|
||||
if self.request.GET.get("item", "") != "":
|
||||
i = self.request.GET.get("item", "")
|
||||
qs = qs.filter(item_id__in=(i,))
|
||||
qs = qs.filter(item_id=i)
|
||||
|
||||
if self.request.GET.get("subevent", "") != "":
|
||||
s = self.request.GET.get("subevent", "")
|
||||
qs = qs.filter(subevent_id=s)
|
||||
|
||||
return qs
|
||||
|
||||
@@ -107,9 +114,9 @@ class WaitingListView(EventPermissionRequiredMixin, ListView):
|
||||
wle.availability = itemvar_cache.get((wle.item, wle.variation))
|
||||
else:
|
||||
wle.availability = (
|
||||
wle.variation.check_quotas(count_waitinglist=False, _cache=quota_cache)
|
||||
wle.variation.check_quotas(count_waitinglist=False, subevent=wle.subevent, _cache=quota_cache)
|
||||
if wle.variation
|
||||
else wle.item.check_quotas(count_waitinglist=False, _cache=quota_cache)
|
||||
else wle.item.check_quotas(count_waitinglist=False, subevent=wle.subevent, _cache=quota_cache)
|
||||
)
|
||||
itemvar_cache[(wle.item, wle.variation)] = wle.availability
|
||||
if wle.availability[0] == 100:
|
||||
|
||||
Reference in New Issue
Block a user