mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
* Checking for the last date in the event series before deleting a date. Last date in a event series should never be delted. * Adding check to ensure that last date in a event series is not deleted. Editing unit test around deleting subevent to assert on alert-danger * Increasing the scope of test_delete. We are now creating 2 subevents and testing deleting one and ensuring that the last one is not deleted * Fixing alert text. Removing a redundant if condition for checking subevent count * Adding assert for second event to ensure its not deleted * Minor fixes and rebase
This commit is contained in:
committed by
Raphael Michel
parent
50575d45c1
commit
dd42037f21
@@ -101,10 +101,13 @@ class SubEventDelete(EventPermissionRequiredMixin, DeleteView):
|
||||
self.object = self.get_object()
|
||||
success_url = self.get_success_url()
|
||||
|
||||
if self.get_object().orderposition_set.count() > 0:
|
||||
if self.object.orderposition_set.count() > 0:
|
||||
messages.error(request, pgettext_lazy('subevent', 'A date can not be deleted if orders already have been '
|
||||
'placed.'))
|
||||
return HttpResponseRedirect(self.get_success_url())
|
||||
elif not self.object.allow_delete(): # checking if this is the last date in the event series
|
||||
messages.error(request, pgettext_lazy('subevent', 'The last date of an event series can not be deleted.'))
|
||||
return HttpResponseRedirect(self.get_success_url())
|
||||
else:
|
||||
self.object.log_action('pretix.subevent.deleted', user=self.request.user)
|
||||
self.object.delete()
|
||||
|
||||
Reference in New Issue
Block a user