flows/importer: fix multiple uses of an importer instance causing errors
This commit is contained in:
parent
860ba994a6
commit
18f42a0edf
|
@ -1,4 +1,5 @@
|
||||||
"""Flow importer"""
|
"""Flow importer"""
|
||||||
|
from copy import deepcopy
|
||||||
from json import loads
|
from json import loads
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
|
@ -130,7 +131,8 @@ class FlowImporter:
|
||||||
def _apply_models(self) -> bool:
|
def _apply_models(self) -> bool:
|
||||||
"""Apply (create/update) flow json"""
|
"""Apply (create/update) flow json"""
|
||||||
self.__pk_map = {}
|
self.__pk_map = {}
|
||||||
for entry in self.__import.entries:
|
entries = deepcopy(self.__import.entries)
|
||||||
|
for entry in entries:
|
||||||
model_app_label, model_name = entry.model.split(".")
|
model_app_label, model_name = entry.model.split(".")
|
||||||
model: SerializerModel = apps.get_model(model_app_label, model_name)
|
model: SerializerModel = apps.get_model(model_app_label, model_name)
|
||||||
# Validate each single entry
|
# Validate each single entry
|
||||||
|
|
Reference in New Issue