summaryrefslogtreecommitdiff
path: root/ishtar_common/migrations/0083_document_index_external_id.py
blob: 4f1dafcf9c7874749d24545857cf468a64a01a21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2019-01-18 17:51
from __future__ import unicode_literals
import sys

from django.db import migrations


def gen_index(apps, schema_editor):
    from ishtar_common.models import Document
    sys.stdout.write("\n")
    q = Document.objects
    ln = q.count()
    for idx, doc in enumerate(Document.objects.all()):
        sys.stdout.write("  * {}/{}\r".format(idx, ln))
        sys.stdout.flush()
        doc._no_move = True
        doc.save()


class Migration(migrations.Migration):

    dependencies = [
        ('ishtar_common', '0082_auto_20190118_1203'),
    ]

    operations = [
        migrations.RunPython(gen_index)
    ]