Add --no-progress-bar option to commands
This commit is contained in:
@@ -13,9 +13,20 @@ class Command(BaseCommand):
|
||||
This will rename all documents to match the latest filename format.
|
||||
""".replace(" ", "")
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
"--no-progress-bar",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="If set, the progress bar will not be shown"
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
logging.getLogger().handlers[0].level = logging.ERROR
|
||||
|
||||
for document in tqdm.tqdm(Document.objects.all()):
|
||||
for document in tqdm.tqdm(
|
||||
Document.objects.all(),
|
||||
disable=options['no_progress_bar']
|
||||
):
|
||||
post_save.send(Document, instance=document)
|
||||
|
||||
Reference in New Issue
Block a user