diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-04 11:46:12 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-04 11:46:12 +0200 | 
| commit | 8443c2b14b2e36c4c633d5cb5f1780ef8c54018a (patch) | |
| tree | c127f6ed3bc71a46c925f81e61947c2fe274fca4 | |
| parent | aec54808951c20c944e8c72fe18366082282fa28 (diff) | |
| download | Ishtar-8443c2b14b2e36c4c633d5cb5f1780ef8c54018a.tar.bz2 Ishtar-8443c2b14b2e36c4c633d5cb5f1780ef8c54018a.zip  | |
Command: fix check model on process_pending_update
| -rw-r--r-- | ishtar_common/management/commands/process_pending_update.py | 11 | 
1 files changed, 5 insertions, 6 deletions
diff --git a/ishtar_common/management/commands/process_pending_update.py b/ishtar_common/management/commands/process_pending_update.py index f0e908d42..6e97847cc 100644 --- a/ishtar_common/management/commands/process_pending_update.py +++ b/ishtar_common/management/commands/process_pending_update.py @@ -48,13 +48,12 @@ class Command(BaseCommand):                      continue                  if not bool(                          [True for k in model._meta.get_fields() -                         if k == "need_update"]): +                         if k.name == "need_update"]):                      continue                  msg = u"-> processing {}: ".format(model._meta.verbose_name) -                ln = model.objects.count() -                for idx, obj_id in enumerate( -                        model.objects.filter( -                            need_update=True).values('pk').all()): +                q = model.objects.filter(need_update=True) +                ln = q.count() +                for idx, obj_id in enumerate(q.values('pk').all()):                      obj = model.objects.get(pk=obj_id['pk'])                      obj.skip_history_when_saving = True                      obj._no_move = True @@ -63,5 +62,5 @@ class Command(BaseCommand):                          sys.stdout.write(cmsg)                          sys.stdout.flush()                      obj.save() -                if not quiet: +                if not quiet and ln:                      sys.stdout.write("\n")  | 
