Added (belatedly) progress bars to some long-running migrations.
- Legacy-Id: 11025
This commit is contained in:
parent
337694ab64
commit
db3a3c3081
|
@ -1,18 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from tqdm import tqdm
|
||||
from django.db import migrations
|
||||
|
||||
def populate_submission_draft(apps, schema_editor):
|
||||
Submission = apps.get_model('submit', 'Submission')
|
||||
Document = apps.get_model('doc', 'Document')
|
||||
print("")
|
||||
for submission in Submission.objects.filter(state_id='posted'):
|
||||
if submission.draft == None:
|
||||
submissions = Submission.objects.filter(state_id='posted', draft=None)
|
||||
count = submissions.count()
|
||||
print(" Fixing up draft information for %s submissions" % count)
|
||||
for submission in tqdm(submissions):
|
||||
try:
|
||||
draft = Document.objects.get(name=submission.name)
|
||||
except Document.DoesNotExist:
|
||||
print( "Failed to find %s-%s" % (submission.name, submission.rev))
|
||||
print( " Failed to find %s-%s" % (submission.name, submission.rev))
|
||||
continue
|
||||
submission.draft = draft
|
||||
submission.save()
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from tqdm import tqdm
|
||||
from django.db import migrations
|
||||
from ietf.submit.checkers import DraftIdnitsChecker, DraftYangChecker
|
||||
|
||||
def set_submission_check_symbol(apps, schema_editor):
|
||||
SubmissionCheck = apps.get_model('submit','SubmissionCheck')
|
||||
for s in SubmissionCheck.objects.all():
|
||||
checks = SubmissionCheck.objects.all()
|
||||
print("")
|
||||
print(" Adding submission check symbol info to existing checks")
|
||||
for s in tqdm():
|
||||
if not s.symbol:
|
||||
if s.checker == "idnits check":
|
||||
s.symbol = DraftIdnitsChecker.symbol
|
||||
|
|
|
@ -27,6 +27,7 @@ python-magic>=0.4.6
|
|||
python-memcached>=1.48 # for django.core.cache.backends.memcached
|
||||
pytz>=2014.7
|
||||
six>=1.8.0
|
||||
tqdm>=3.5.0
|
||||
Unidecode>=0.4.18
|
||||
#wsgiref>=0.1.2
|
||||
xml2rfc>=2.5.
|
||||
|
|
Loading…
Reference in a new issue