* adds more detailed situation check on check_for_recorded_instance()
This commit is contained in:
mpeltriaux 2022-08-10 09:28:43 +02:00
parent 982d9f1930
commit a5f0d7f8c6

View File

@ -15,6 +15,7 @@ from django.contrib import messages
from django.contrib.gis import gdal from django.contrib.gis import gdal
from django.db.models.fields.files import FieldFile from django.db.models.fields.files import FieldFile
from compensation.models import EcoAccount
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP
from user.models import User from user.models import User
from django.contrib.gis.forms import MultiPolygonField from django.contrib.gis.forms import MultiPolygonField
@ -156,16 +157,16 @@ class BaseForm(forms.Form):
RemoveEcoAccountDeductionModalForm RemoveEcoAccountDeductionModalForm
is_none = self.instance is None is_none = self.instance is None
is_other_data_type = not isinstance(self.instance, BaseObject) is_other_data_type = not isinstance(self.instance, BaseObject)
is_deduction_form = isinstance( is_deduction_form_from_account = isinstance(
self, self,
( (
NewDeductionModalForm, NewDeductionModalForm,
EditEcoAccountDeductionModalForm, EditEcoAccountDeductionModalForm,
RemoveEcoAccountDeductionModalForm, 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 # Do nothing
return return