Do not CASCADE-delete vouchers when deleting items or quotas

This commit is contained in:
Raphael Michel
2019-07-11 12:33:42 +02:00
parent f066ed01ff
commit d994fc674a
6 changed files with 66 additions and 20 deletions

View File

@@ -771,7 +771,8 @@ class QuotaDelete(EventPermissionRequiredMixin, DeleteView):
def get_context_data(self, *args, **kwargs) -> dict:
context = super().get_context_data(*args, **kwargs)
context['dependent'] = list(self.get_object().items.all())
context['dependent'] = list(self.object.items.all())
context['vouchers'] = self.object.vouchers.count()
return context
@transaction.atomic
@@ -1183,6 +1184,7 @@ class ItemDelete(EventPermissionRequiredMixin, DeleteView):
def get_context_data(self, *args, **kwargs) -> dict:
context = super().get_context_data(*args, **kwargs)
context['possible'] = self.is_allowed()
context['vouchers'] = self.object.vouchers.count()
return context
def is_allowed(self) -> bool: