--- 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):