Don't try to migrate defective documents.
This change hardens the migration to not fail on documents without
doucument version from a failed import ('Uninitialized document').
This commit is contained in:
@@ -15,7 +15,8 @@ class Migration(DataMigration):
|
|||||||
# NOTE: This migration take a while. Maybe the use of F objects could
|
# NOTE: This migration take a while. Maybe the use of F objects could
|
||||||
# improve it.
|
# improve it.
|
||||||
for document in orm.Document.objects.all():
|
for document in orm.Document.objects.all():
|
||||||
document.label = document.versions.order_by('timestamp').last().filename
|
if document.versions.order_by('timestamp').last():
|
||||||
|
document.label = document.versions.order_by('timestamp').last().filename
|
||||||
document.save()
|
document.save()
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
|
|||||||
Reference in New Issue
Block a user