From a5f0d7f8c607f597bacbb02f66b19f558c7bf96d Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Wed, 10 Aug 2022 09:28:43 +0200 Subject: [PATCH] Fix * adds more detailed situation check on check_for_recorded_instance() --- konova/forms.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/konova/forms.py b/konova/forms.py index ced2bf10..67014260 100644 --- a/konova/forms.py +++ b/konova/forms.py @@ -15,6 +15,7 @@ from django.contrib import messages from django.contrib.gis import gdal from django.db.models.fields.files import FieldFile +from compensation.models import EcoAccount from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP from user.models import User from django.contrib.gis.forms import MultiPolygonField @@ -156,16 +157,16 @@ class BaseForm(forms.Form): RemoveEcoAccountDeductionModalForm is_none = self.instance is None is_other_data_type = not isinstance(self.instance, BaseObject) - is_deduction_form = isinstance( + is_deduction_form_from_account = isinstance( self, ( NewDeductionModalForm, EditEcoAccountDeductionModalForm, RemoveEcoAccountDeductionModalForm, ) - ) + ) and isinstance(self.instance, EcoAccount) - if is_none or is_other_data_type or is_deduction_form: + if is_none or is_other_data_type or is_deduction_form_from_account: # Do nothing return