From 50e8918a561c06542a5ef51658c69a07c7d7492b Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Mon, 9 Mar 2020 18:03:09 +0000 Subject: [PATCH] Added a progress bar for verbosity=1 of the community list index update command. - Legacy-Id: 17414 --- .../management/commands/update_community_list_index.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ietf/utils/management/commands/update_community_list_index.py b/ietf/utils/management/commands/update_community_list_index.py index 299038388..4fc64facb 100644 --- a/ietf/utils/management/commands/update_community_list_index.py +++ b/ietf/utils/management/commands/update_community_list_index.py @@ -1,9 +1,10 @@ -# Copyright The IETF Trust 2019, All Rights Reserved +# Copyright The IETF Trust 2019-2020, All Rights Reserved # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals +from tqdm import tqdm from django.core.management.base import BaseCommand @@ -23,7 +24,8 @@ class Command(BaseCommand): def handle(self, *args, **options): - for rule in SearchRule.objects.filter(rule_type='name_contains'): + verbosity = options.get('verbosity', 1) + for rule in tqdm(SearchRule.objects.filter(rule_type='name_contains'), disable=(verbosity!=1)): count1 = rule.name_contains_index.count() if not options['dry_run']: reset_name_contains_index_for_rule(rule)