From d767ef1a7af54852be36b464ba45881157ced1c6 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sun, 1 Jan 2023 09:18:01 +0100 Subject: [PATCH] Fix invoice delete --- nummi/main/models.py | 2 +- nummi/main/views.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/nummi/main/models.py b/nummi/main/models.py index e051b81..5d8cb3c 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -300,7 +300,7 @@ class Invoice(CustomModel): return str(self.name) def delete(self, *args, **kwargs): - self.file.delete(missing_ok=True) + self.file.delete() super().delete(*args, **kwargs) def get_absolute_url(self): diff --git a/nummi/main/views.py b/nummi/main/views.py index 5fd1a084..92a8ec4 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -247,8 +247,14 @@ class InvoiceDeleteView(NummiDeleteView): return reverse_lazy("transaction", kwargs={"pk": self.object.transaction.pk}) def get_queryset(self): - return super.get_queryset().filter( - transaction=get_object_or_404(Transaction, pk=self.kwargs["transaction_pk"]) + return ( + super() + .get_queryset() + .filter( + transaction=get_object_or_404( + Transaction, pk=self.kwargs["transaction_pk"] + ) + ) )