#285 Drop atom_id from API

* refactors code usage from atom_id to id inside of api app
This commit is contained in:
2023-02-01 08:08:52 +01:00
parent 123d02abf9
commit 882468cde6
2 changed files with 11 additions and 15 deletions

View File

@@ -61,7 +61,7 @@ class AbstractModelAPISerializerV1(AbstractModelAPISerializer):
if konova_code is None:
return None
return {
"atom_id": konova_code.atom_id,
"id": konova_code.id,
"long_name": konova_code.long_name,
"short_name": konova_code.short_name,
}
@@ -70,7 +70,7 @@ class AbstractModelAPISerializerV1(AbstractModelAPISerializer):
""" Returns a konova code instance
Args:
json_str (str): The value for the code (atom id)
json_str (str): The value for the code (id)
code_list_identifier (str): From which konova code list this code is supposed to be from
Returns:
@@ -83,7 +83,7 @@ class AbstractModelAPISerializerV1(AbstractModelAPISerializer):
return None
try:
code = KonovaCode.objects.get(
atom_id=json_str,
id=json_str,
code_lists__in=[code_list_identifier]
)
except ObjectDoesNotExist as e:
@@ -360,7 +360,7 @@ class AbstractCompensationAPISerializerV1Mixin:
# If this exact data is already existing, we do not create it new. Instead put it's id in the list of
# entries, we will use to set the new actions
state = states_manager.filter(
biotope_type__atom_id=biotope_type,
biotope_type__id=biotope_type,
surface=surface,
).exclude(
id__in=states