wip: open question sample
[edumed.git] / curriculum / migrations / 0007_translatable_fields_data_migration.py
1 # -*- coding: utf-8 -*-
2 import datetime
3 from south.db import db
4 from south.v2 import DataMigration
5 from django.db import models
6
7 class Migration(DataMigration):
8
9     def forwards(self, orm):
10         for section in orm.Section.objects.all():
11             section.name_pl = section.name_en = section.name
12             section.save()
13         for competence in orm.Competence.objects.all():
14             competence.name_pl = competence.name_en = competence.name
15             competence.save()
16         for level in orm.Level.objects.all():
17             level.name_pl = level.name_en = level.name
18             level.group_pl = level.group_en = level.group
19             level.save()
20         for competence_level in orm.CompetenceLevel.objects.all():
21             competence_level.description_pl = competence_level.description_en = competence_level.description
22             competence_level.save()
23
24     def backwards(self, orm):
25         raise RuntimeError("Cannot reverse this migration.")
26
27     models = {
28         u'curriculum.competence': {
29             'Meta': {'ordering': "['section', 'order']", 'object_name': 'Competence'},
30             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
31             'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
32             'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
33             'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
34             'order': ('django.db.models.fields.IntegerField', [], {}),
35             'section': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Section']"}),
36             'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
37         },
38         u'curriculum.competencelevel': {
39             'Meta': {'ordering': "['competence', 'level']", 'object_name': 'CompetenceLevel'},
40             'competence': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Competence']"}),
41             'description': ('django.db.models.fields.TextField', [], {}),
42             'description_en': ('django.db.models.fields.TextField', [], {'null': 'True'}),
43             'description_pl': ('django.db.models.fields.TextField', [], {'null': 'True'}),
44             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
45             'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Level']"})
46         },
47         u'curriculum.curriculum': {
48             'Meta': {'object_name': 'Curriculum'},
49             'course': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumCourse']"}),
50             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
51             'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
52             'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumLevel']"}),
53             'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
54             'type': ('django.db.models.fields.CharField', [], {'max_length': '16'})
55         },
56         u'curriculum.curriculumcourse': {
57             'Meta': {'ordering': "['slug']", 'object_name': 'CurriculumCourse'},
58             'accusative': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
59             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
60             'slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
61             'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
62         },
63         u'curriculum.curriculumlevel': {
64             'Meta': {'object_name': 'CurriculumLevel'},
65             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
66             'title': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'})
67         },
68         u'curriculum.level': {
69             'Meta': {'ordering': "['order']", 'object_name': 'Level'},
70             'group': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
71             'group_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
72             'group_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
73             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
74             'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
75             'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
76             'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
77             'order': ('django.db.models.fields.IntegerField', [], {}),
78             'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'})
79         },
80         u'curriculum.section': {
81             'Meta': {'ordering': "['order']", 'object_name': 'Section'},
82             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
83             'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
84             'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
85             'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
86             'order': ('django.db.models.fields.IntegerField', [], {}),
87             'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
88         }
89     }
90
91     complete_apps = ['curriculum']
92     symmetrical = True