diff --git a/compensation/views/compensation/compensation.py b/compensation/views/compensation/compensation.py index 1e3553a8..d5d77157 100644 --- a/compensation/views/compensation/compensation.py +++ b/compensation/views/compensation/compensation.py @@ -203,7 +203,12 @@ def detail_view(request: HttpRequest, id: str): """ template = "compensation/detail/compensation/view.html" - comp = get_object_or_404(Compensation, id=id) + comp = get_object_or_404( + Compensation, + id=id, + deleted=None, + intervention__deleted=None, + ) geom_form = SimpleGeomForm(instance=comp) parcels = comp.get_underlying_parcels() _user = request.user diff --git a/compensation/views/eco_account/eco_account.py b/compensation/views/eco_account/eco_account.py index 077df148..99344cfd 100644 --- a/compensation/views/eco_account/eco_account.py +++ b/compensation/views/eco_account/eco_account.py @@ -184,7 +184,8 @@ def detail_view(request: HttpRequest, id: str): 'geometry', 'responsible', ), - id=id + id=id, + deleted=None, ) geom_form = SimpleGeomForm(instance=acc) parcels = acc.get_underlying_parcels() diff --git a/intervention/views/intervention.py b/intervention/views/intervention.py index 329e7d5f..0dd59bdf 100644 --- a/intervention/views/intervention.py +++ b/intervention/views/intervention.py @@ -143,7 +143,8 @@ def detail_view(request: HttpRequest, id: str): "legal", "responsible", ), - id=id + id=id, + deleted=None ) compensations = intervention.compensations.filter( deleted=None, diff --git a/konova/models/document.py b/konova/models/document.py index b465d70c..70ff3d79 100644 --- a/konova/models/document.py +++ b/konova/models/document.py @@ -87,7 +87,7 @@ class AbstractDocument(BaseResource): """ try: os.remove(self.file.file.name) - except FileNotFoundError: + except (FileNotFoundError, ValueError): # File seems to missing anyway - continue! pass super().delete(using=using, keep_parents=keep_parents) @@ -113,7 +113,7 @@ class AbstractDocument(BaseResource): """ try: os.remove(self.file.file.name) - except FileNotFoundError: + except (FileNotFoundError, ValueError): pass self.file = new_file - self.save() \ No newline at end of file + self.save()