Add --no-progress-bar option to commands

This commit is contained in:
Stéphane Brunner
2021-04-18 15:56:00 +02:00
parent 17b9d7eb42
commit dc26c9b7cc
10 changed files with 83 additions and 21 deletions

View File

@@ -60,12 +60,7 @@ def check_sanity(progress=False):
if lockfile in present_files:
present_files.remove(lockfile)
if progress:
docs = tqdm(Document.objects.all())
else:
docs = Document.objects.all()
for doc in docs:
for doc in tqdm(Document.objects.all(), disable=not progress):
# Check sanity of the thumbnail
if not os.path.isfile(doc.thumbnail_path):
messages.error(f"Thumbnail of document {doc.pk} does not exist.")