diff --git a/postgres_searchindex/management/commands/_utils.py b/postgres_searchindex/management/commands/_utils.py index 9fe0974..b93bdfb 100644 --- a/postgres_searchindex/management/commands/_utils.py +++ b/postgres_searchindex/management/commands/_utils.py @@ -37,4 +37,4 @@ def update_indexes(): object_id__in=current_ids, ) delete_result = to_delete.delete() - sys.stdout.write(f"> Done. Removed from index: {delete_result[0]}") \ No newline at end of file + sys.stdout.write(f"> Done. Removed from index: {delete_result[0]}") diff --git a/postgres_searchindex/management/commands/postgres_searchindex_rebuild.py b/postgres_searchindex/management/commands/postgres_searchindex_rebuild.py index 67f8d01..5088db6 100644 --- a/postgres_searchindex/management/commands/postgres_searchindex_rebuild.py +++ b/postgres_searchindex/management/commands/postgres_searchindex_rebuild.py @@ -1,27 +1,29 @@ # commands/reindex_indexes.py from django.core.management import BaseCommand + from ._utils import delete_indexes, update_indexes + class Command(BaseCommand): help = "Reindexing postgres " def add_arguments(self, parser): parser.add_argument( - '--force', - action='store_true', - help='Force reindex without confirmation' + "--force", action="store_true", help="Force reindex without confirmation" ) def handle(self, *args, **options): - if not options['force']: - self.stdout.write(self.style.WARNING( - "This will delete all indexes and reindex them." - " Are you sure you want to proceed?" - )) + if not options["force"]: + self.stdout.write( + self.style.WARNING( + "This will delete all indexes and reindex them." + " Are you sure you want to proceed?" + ) + ) confirmation = input("Type 'yes' to continue: ") - if confirmation.lower() != 'yes': + if confirmation.lower() != "yes": self.stdout.write(self.style.ERROR("Reindexing aborted.")) return