flows/importer: fix multiple uses of an importer instance causing errors

This commit is contained in:
Jens Langhammer 2020-09-09 17:21:16 +02:00
parent 860ba994a6
commit 18f42a0edf
1 changed files with 3 additions and 1 deletions

View File

@ -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