From 8b0c472d28bc4bdecc7ea120bfeb604d9afd2a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Fri, 27 Dec 2024 16:35:37 +0100 Subject: [PATCH] importhub should be able to delete --- .../mapdata/management/commands/importhub.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/c3nav/mapdata/management/commands/importhub.py b/src/c3nav/mapdata/management/commands/importhub.py index aa147f5a..32e68e81 100644 --- a/src/c3nav/mapdata/management/commands/importhub.py +++ b/src/c3nav/mapdata/management/commands/importhub.py @@ -354,15 +354,18 @@ class Command(BaseCommand): ", is now"+str([group.title for group in new_groups]), new_group_ids, old_group_ids) for import_tag, location in locations_so_far.items(): - self.do_report( - prefix='hub:new_groups', - obj_id=import_tag, - obj=import_tag, - report=Report( - category="location-issue", - title="importhub: delete this", - description="hub wants to delete this", - location=location, + if location.import_block_data: + self.do_report( + prefix='hub:new_groups', + obj_id=import_tag, + obj=import_tag, + report=Report( + category="location-issue", + title="importhub: delete this", + description="hub wants to delete this but it's blocked", + location=location, + ) ) - ) - print(f"NOTE: {location.slug} / {import_tag} should be deleted") + print(f"NOTE: {location.slug} / {import_tag} should be deleted") + else: + location.delete()