Enforce start and end time of presale (#15)

This commit is contained in:
Raphael Michel
2015-04-16 17:40:08 +02:00
parent 1532b3f1ee
commit 14c582d11e
9 changed files with 209 additions and 90 deletions

View File

@@ -99,6 +99,13 @@ class CartAdd(EventViewMixin, CartActionMixin, View):
self.msg_some_unavailable = False
def post(self, request, *args, **kwargs):
if request.event.presale_start and now() < request.event.presale_start:
messages.error(request, _('The presale period not yet started.'))
return redirect(self.get_failure_url())
if request.event.presale_end and now() > request.event.presale_end:
messages.error(request, _('The presale period has ended.'))
return redirect(self.get_failure_url())
self.items = self._items_from_post_data()
# We do not use EventLoginRequiredMixin here, as we want to store stuff into the