# HG changeset patch # User verrierj # Date 1326274523 -3600 # Node ID a1fd64fbb6809c6ffecc14e2ee9a89bde85038c4 # Parent 76724cebff9588662ed4242189bf0d73ea5594f6 Set default values for unannotated medias diff -r 76724cebff95 -r a1fd64fbb680 src/ldt/ldt/ldt_utils/migrations/0011_gen_stat_annotation.py --- a/src/ldt/ldt/ldt_utils/migrations/0011_gen_stat_annotation.py Tue Jan 10 16:09:28 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/migrations/0011_gen_stat_annotation.py Wed Jan 11 10:35:23 2012 +0100 @@ -4,7 +4,7 @@ from south.db import db from south.v2 import DataMigration from django.db import models -from ldt.ldt_utils.stat import update_stat_project +from ldt.ldt_utils.stat import update_stat_project, update_stat_content class Migration(DataMigration): @@ -14,6 +14,12 @@ for proj in orm.Project.objects.all(): update_stat_project(proj) + + # Sets fields nb_annotation and stat_annotation to 0 and 0,0,...,0 + # for contents that do not have annotations + for content in orm.Content.objects.all(): + if not content.stat_annotation: + update_stat_content(content) def backwards(self, orm):