summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-05-21 15:20:18 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-06-17 13:21:28 +0200
commit67b818c30a6e406017b70b8915145c00d6202fa7 (patch)
treea70475030cfd441fcc43ddb0cd706078e06c101d /ishtar_common
parent433a7952c6f0807b1792b023a54cf98801748fce (diff)
downloadIshtar-67b818c30a6e406017b70b8915145c00d6202fa7.tar.bz2
Ishtar-67b818c30a6e406017b70b8915145c00d6202fa7.zip
regenerate_search_vector_cached_label: performance fix
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/management/commands/regenerate_search_vector_cached_label.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ishtar_common/management/commands/regenerate_search_vector_cached_label.py b/ishtar_common/management/commands/regenerate_search_vector_cached_label.py
index 542e5f915..8ac0dae03 100644
--- a/ishtar_common/management/commands/regenerate_search_vector_cached_label.py
+++ b/ishtar_common/management/commands/regenerate_search_vector_cached_label.py
@@ -64,13 +64,14 @@ class Command(BaseCommand):
continue
msg = u"-> processing {}: ".format(model._meta.verbose_name)
ln = model.objects.count()
- for idx, object in enumerate(model.objects.all()):
- object.skip_history_when_saving = True
- object._no_move = True
+ for idx, obj_id in enumerate(model.objects.values('id').all()):
+ obj = model.objects.get(pk=obj_id['id'])
+ obj.skip_history_when_saving = True
+ obj._no_move = True
cmsg = u"\r{} {}/{}".format(msg, idx + 1, ln)
if not quiet:
sys.stdout.write(cmsg)
sys.stdout.flush()
- object.save()
+ obj.save()
if not quiet:
sys.stdout.write("\n")