From 9b5ee2e0b7737c139151cf3c776618b79a60cede Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Wed, 17 Apr 2024 14:09:23 +0200 Subject: [PATCH] fix(management): add history_type to relations --- .../management/commands/relations_import_from_json.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apis_ontology/management/commands/relations_import_from_json.py b/apis_ontology/management/commands/relations_import_from_json.py index b9a0fce..55795b9 100644 --- a/apis_ontology/management/commands/relations_import_from_json.py +++ b/apis_ontology/management/commands/relations_import_from_json.py @@ -130,6 +130,7 @@ def import_relations(): tt._history_date = timestamp revision_user, _ = User.objects.get_or_create(username=revision["user"]) tt.save() + tt.history.filter(history_date=timestamp).update(history_type="+") if revision_user: tt.history.filter(history_date=timestamp).update(history_user=revision_user.id) except Exception as e: @@ -146,5 +147,6 @@ class Command(BaseCommand): help = "Import relation data from legacy APIS instance" def handle(self, *args, **options): - fetch_relations() + if not relation_file.exists(): + fetch_relations() import_relations()