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
|
||||
# improve it.
|
||||
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()
|
||||
|
||||
def backwards(self, orm):
|
||||
|
||||
Reference in New Issue
Block a user