summaryrefslogtreecommitdiff
path: root/ishtar_common/management
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-02-16 19:59:32 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-02-16 19:59:32 +0100
commitfb77a14ba933d4f5ae62ea76e41ecfc01f79ae78 (patch)
treed337da44da290ca17f2cab7264d9ae17b3d72721 /ishtar_common/management
parent771afa9940dd9ecb4c935189f30d553bcd020801 (diff)
downloadIshtar-fb77a14ba933d4f5ae62ea76e41ecfc01f79ae78.tar.bz2
Ishtar-fb77a14ba933d4f5ae62ea76e41ecfc01f79ae78.zip
Update search vectors script: output total updated
Diffstat (limited to 'ishtar_common/management')
-rw-r--r--ishtar_common/management/commands/update_search_vectors.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ishtar_common/management/commands/update_search_vectors.py b/ishtar_common/management/commands/update_search_vectors.py
index f30f40f4e..59166fba7 100644
--- a/ishtar_common/management/commands/update_search_vectors.py
+++ b/ishtar_common/management/commands/update_search_vectors.py
@@ -21,6 +21,7 @@ class Command(BaseCommand):
def handle(self, *args, **options):
quiet = options['quiet']
+ total = 0
for model in django.apps.apps.get_models():
if options['model'] and model.__name__ != options['model']:
continue
@@ -32,6 +33,7 @@ class Command(BaseCommand):
if not quiet:
self.stdout.write("\n* update {}".format(model))
total = model.objects.count()
+ idx = 0
for idx, item in enumerate(model.objects.all()):
if not quiet:
sys.stdout.write("\r{}/{} ".format(idx + 1, total))
@@ -40,5 +42,7 @@ class Command(BaseCommand):
item.update_search_vector()
except:
pass
+ total += idx
if not quiet:
self.stdout.write("\n")
+ self.stdout.write("{} items updated\n".format(total))