From f2525e150927fef369b51a9a34b2e497564562e0 Mon Sep 17 00:00:00 2001 From: Cyrus Hiatt Date: Fri, 27 Sep 2024 15:27:34 -0700 Subject: [PATCH 1/2] Copy sample_index.py to project during updateproject --- arches/management/commands/updateproject.py | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/arches/management/commands/updateproject.py b/arches/management/commands/updateproject.py index c5d342e1d9d..c77b558d641 100644 --- a/arches/management/commands/updateproject.py +++ b/arches/management/commands/updateproject.py @@ -302,6 +302,44 @@ def update_to_v7_6(self): os.path.join(settings.APP_ROOT, "apps.py"), ) + if os.path.isfile( + os.path.join( + settings.APP_ROOT, "search_indexes", "sample_index.py" + ) + ): + self.stderr.write( + "Existing sample_index.py detected. Skipping creation of sample_index.py", + ) + else: + self.stdout.write(f"Creating /{settings.APP_NAME}/search_indexes/sample_index.py") + src_path = os.path.join(settings.APP_ROOT, "search_indexes") + if not os.path.isdir(src_path): + os.mkdir(src_path) + + shutil.copy2( + os.path.join( + settings.ROOT_DIR, + "install", + "arches-templates", + "project_name", + "search_indexes", + "sample_index.py", + ), + src_path, + ) + self.stdout.write(f"Creating /{settings.APP_NAME}/search_indexes/__init__.py") + shutil.copy2( + os.path.join( + settings.ROOT_DIR, + "install", + "arches-templates", + "project_name", + "search_indexes", + "__init__.py", + ), + src_path, + ) + if os.path.isfile( os.path.join( settings.APP_ROOT, "src", settings.APP_NAME, "declarations.d.ts" From f76eb1cfea3a059e578b7fb7ae28961cb01d8f65 Mon Sep 17 00:00:00 2001 From: Cyrus Hiatt Date: Fri, 27 Sep 2024 15:37:56 -0700 Subject: [PATCH 2/2] format --- arches/management/commands/updateproject.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arches/management/commands/updateproject.py b/arches/management/commands/updateproject.py index c77b558d641..1b0a3055039 100644 --- a/arches/management/commands/updateproject.py +++ b/arches/management/commands/updateproject.py @@ -303,15 +303,15 @@ def update_to_v7_6(self): ) if os.path.isfile( - os.path.join( - settings.APP_ROOT, "search_indexes", "sample_index.py" - ) + os.path.join(settings.APP_ROOT, "search_indexes", "sample_index.py") ): self.stderr.write( "Existing sample_index.py detected. Skipping creation of sample_index.py", ) else: - self.stdout.write(f"Creating /{settings.APP_NAME}/search_indexes/sample_index.py") + self.stdout.write( + f"Creating /{settings.APP_NAME}/search_indexes/sample_index.py" + ) src_path = os.path.join(settings.APP_ROOT, "search_indexes") if not os.path.isdir(src_path): os.mkdir(src_path) @@ -327,7 +327,9 @@ def update_to_v7_6(self): ), src_path, ) - self.stdout.write(f"Creating /{settings.APP_NAME}/search_indexes/__init__.py") + self.stdout.write( + f"Creating /{settings.APP_NAME}/search_indexes/__init__.py" + ) shutil.copy2( os.path.join( settings.ROOT_DIR,