Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
benzkji committed May 8, 2024
1 parent c70f182 commit 5a7a661
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion postgres_searchindex/management/commands/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]}")
sys.stdout.write(f"> Done. Removed from index: {delete_result[0]}")
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 5a7a661

Please sign in to comment.