From: Aleksander Ɓukasz Date: Wed, 16 Oct 2013 08:33:46 +0000 (+0200) Subject: Support for English language in the curriculum app X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/ab456c38cd1974163ac4a390756770687297aaab?ds=sidebyside Support for English language in the curriculum app --- diff --git a/curriculum/admin.py b/curriculum/admin.py index 275baf8..4e83537 100755 --- a/curriculum/admin.py +++ b/curriculum/admin.py @@ -7,16 +7,16 @@ class CompetenceLevelInline(admin.TabularInline): class CompetenceAdmin(admin.ModelAdmin): model = Competence - list_display = ['name', 'section', 'slug', 'order'] + list_display = ['name_pl', 'name_en', 'section', 'slug', 'order'] inlines = [CompetenceLevelInline] class LevelAdmin(admin.ModelAdmin): model = Level - list_display = ['name', 'group', 'slug', 'order'] + list_display = ['name_pl', 'name_en', 'group_pl', 'group_en', 'slug', 'order'] class SectionAdmin(admin.ModelAdmin): model = Section - list_display = ['name', 'slug', 'order'] + list_display = ['name_pl', 'name_en', 'slug', 'order'] admin.site.register(Level, LevelAdmin) diff --git a/curriculum/migrations/0006_auto__add_field_competencelevel_description_pl__add_field_competencele.py b/curriculum/migrations/0006_auto__add_field_competencelevel_description_pl__add_field_competencele.py new file mode 100644 index 0000000..d62e37a --- /dev/null +++ b/curriculum/migrations/0006_auto__add_field_competencelevel_description_pl__add_field_competencele.py @@ -0,0 +1,158 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'CompetenceLevel.description_pl' + db.add_column(u'curriculum_competencelevel', 'description_pl', + self.gf('django.db.models.fields.TextField')(null=True), + keep_default=False) + + # Adding field 'CompetenceLevel.description_en' + db.add_column(u'curriculum_competencelevel', 'description_en', + self.gf('django.db.models.fields.TextField')(null=True), + keep_default=False) + + # Adding field 'Section.name_pl' + db.add_column(u'curriculum_section', 'name_pl', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True), + keep_default=False) + + # Adding field 'Section.name_en' + db.add_column(u'curriculum_section', 'name_en', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True), + keep_default=False) + + # Adding field 'Competence.name_pl' + db.add_column(u'curriculum_competence', 'name_pl', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True), + keep_default=False) + + # Adding field 'Competence.name_en' + db.add_column(u'curriculum_competence', 'name_en', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True), + keep_default=False) + + # Adding field 'Level.name_pl' + db.add_column(u'curriculum_level', 'name_pl', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True), + keep_default=False) + + # Adding field 'Level.name_en' + db.add_column(u'curriculum_level', 'name_en', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True), + keep_default=False) + + # Adding field 'Level.group_pl' + db.add_column(u'curriculum_level', 'group_pl', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True), + keep_default=False) + + # Adding field 'Level.group_en' + db.add_column(u'curriculum_level', 'group_en', + self.gf('django.db.models.fields.CharField')(max_length=255, null=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'CompetenceLevel.description_pl' + db.delete_column(u'curriculum_competencelevel', 'description_pl') + + # Deleting field 'CompetenceLevel.description_en' + db.delete_column(u'curriculum_competencelevel', 'description_en') + + # Deleting field 'Section.name_pl' + db.delete_column(u'curriculum_section', 'name_pl') + + # Deleting field 'Section.name_en' + db.delete_column(u'curriculum_section', 'name_en') + + # Deleting field 'Competence.name_pl' + db.delete_column(u'curriculum_competence', 'name_pl') + + # Deleting field 'Competence.name_en' + db.delete_column(u'curriculum_competence', 'name_en') + + # Deleting field 'Level.name_pl' + db.delete_column(u'curriculum_level', 'name_pl') + + # Deleting field 'Level.name_en' + db.delete_column(u'curriculum_level', 'name_en') + + # Deleting field 'Level.group_pl' + db.delete_column(u'curriculum_level', 'group_pl') + + # Deleting field 'Level.group_en' + db.delete_column(u'curriculum_level', 'group_en') + + + models = { + u'curriculum.competence': { + 'Meta': {'ordering': "['section', 'order']", 'object_name': 'Competence'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'section': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Section']"}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}) + }, + u'curriculum.competencelevel': { + 'Meta': {'ordering': "['competence', 'level']", 'object_name': 'CompetenceLevel'}, + 'competence': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Competence']"}), + 'description': ('django.db.models.fields.TextField', [], {}), + 'description_en': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'description_pl': ('django.db.models.fields.TextField', [], {'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Level']"}) + }, + u'curriculum.curriculum': { + 'Meta': {'object_name': 'Curriculum'}, + 'course': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumCourse']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumLevel']"}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '16'}) + }, + u'curriculum.curriculumcourse': { + 'Meta': {'ordering': "['slug']", 'object_name': 'CurriculumCourse'}, + 'accusative': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'curriculum.curriculumlevel': { + 'Meta': {'object_name': 'CurriculumLevel'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) + }, + u'curriculum.level': { + 'Meta': {'ordering': "['order']", 'object_name': 'Level'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'group_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'group_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'curriculum.section': { + 'Meta': {'ordering': "['order']", 'object_name': 'Section'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}) + } + } + + complete_apps = ['curriculum'] \ No newline at end of file diff --git a/curriculum/migrations/0007_translatable_fields_data_migration.py b/curriculum/migrations/0007_translatable_fields_data_migration.py new file mode 100644 index 0000000..f881621 --- /dev/null +++ b/curriculum/migrations/0007_translatable_fields_data_migration.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import DataMigration +from django.db import models + +class Migration(DataMigration): + + def forwards(self, orm): + for section in orm.Section.objects.all(): + section.name_pl = section.name_en = section.name + section.save() + for competence in orm.Competence.objects.all(): + competence.name_pl = competence.name_en = competence.name + competence.save() + for level in orm.Level.objects.all(): + level.name_pl = level.name_en = level.name + level.group_pl = level.group_en = level.group + level.save() + for competence_level in orm.CompetenceLevel.objects.all(): + competence_level.description_pl = competence_level.description_en = competence_level.description + competence_level.save() + + def backwards(self, orm): + raise RuntimeError("Cannot reverse this migration.") + + models = { + u'curriculum.competence': { + 'Meta': {'ordering': "['section', 'order']", 'object_name': 'Competence'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'section': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Section']"}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}) + }, + u'curriculum.competencelevel': { + 'Meta': {'ordering': "['competence', 'level']", 'object_name': 'CompetenceLevel'}, + 'competence': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Competence']"}), + 'description': ('django.db.models.fields.TextField', [], {}), + 'description_en': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'description_pl': ('django.db.models.fields.TextField', [], {'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Level']"}) + }, + u'curriculum.curriculum': { + 'Meta': {'object_name': 'Curriculum'}, + 'course': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumCourse']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumLevel']"}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '16'}) + }, + u'curriculum.curriculumcourse': { + 'Meta': {'ordering': "['slug']", 'object_name': 'CurriculumCourse'}, + 'accusative': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'curriculum.curriculumlevel': { + 'Meta': {'object_name': 'CurriculumLevel'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) + }, + u'curriculum.level': { + 'Meta': {'ordering': "['order']", 'object_name': 'Level'}, + 'group': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'group_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'group_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'curriculum.section': { + 'Meta': {'ordering': "['order']", 'object_name': 'Section'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}) + } + } + + complete_apps = ['curriculum'] + symmetrical = True diff --git a/curriculum/migrations/0008_auto__del_field_competencelevel_description__del_field_section_name__d.py b/curriculum/migrations/0008_auto__del_field_competencelevel_description__del_field_section_name__d.py new file mode 100644 index 0000000..4c0a89a --- /dev/null +++ b/curriculum/migrations/0008_auto__del_field_competencelevel_description__del_field_section_name__d.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Deleting field 'CompetenceLevel.description' + db.delete_column(u'curriculum_competencelevel', 'description') + + # Deleting field 'Section.name' + db.delete_column(u'curriculum_section', 'name') + + # Deleting field 'Competence.name' + db.delete_column(u'curriculum_competence', 'name') + + # Deleting field 'Level.group' + db.delete_column(u'curriculum_level', 'group') + + # Deleting field 'Level.name' + db.delete_column(u'curriculum_level', 'name') + + + def backwards(self, orm): + + # User chose to not deal with backwards NULL issues for 'CompetenceLevel.description' + raise RuntimeError("Cannot reverse this migration. 'CompetenceLevel.description' and its values cannot be restored.") + + # User chose to not deal with backwards NULL issues for 'Section.name' + raise RuntimeError("Cannot reverse this migration. 'Section.name' and its values cannot be restored.") + + # User chose to not deal with backwards NULL issues for 'Competence.name' + raise RuntimeError("Cannot reverse this migration. 'Competence.name' and its values cannot be restored.") + + # User chose to not deal with backwards NULL issues for 'Level.group' + raise RuntimeError("Cannot reverse this migration. 'Level.group' and its values cannot be restored.") + + # User chose to not deal with backwards NULL issues for 'Level.name' + raise RuntimeError("Cannot reverse this migration. 'Level.name' and its values cannot be restored.") + + models = { + u'curriculum.competence': { + 'Meta': {'ordering': "['section', 'order']", 'object_name': 'Competence'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'section': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Section']"}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}) + }, + u'curriculum.competencelevel': { + 'Meta': {'ordering': "['competence', 'level']", 'object_name': 'CompetenceLevel'}, + 'competence': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Competence']"}), + 'description_en': ('django.db.models.fields.TextField', [], {'null': 'True'}), + 'description_pl': ('django.db.models.fields.TextField', [], {'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Level']"}) + }, + u'curriculum.curriculum': { + 'Meta': {'object_name': 'Curriculum'}, + 'course': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumCourse']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumLevel']"}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '16'}) + }, + u'curriculum.curriculumcourse': { + 'Meta': {'ordering': "['slug']", 'object_name': 'CurriculumCourse'}, + 'accusative': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'curriculum.curriculumlevel': { + 'Meta': {'object_name': 'CurriculumLevel'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) + }, + u'curriculum.level': { + 'Meta': {'ordering': "['order']", 'object_name': 'Level'}, + 'group_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'group_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'curriculum.section': { + 'Meta': {'ordering': "['order']", 'object_name': 'Section'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}) + } + } + + complete_apps = ['curriculum'] \ No newline at end of file diff --git a/curriculum/migrations/0009_auto__chg_field_competencelevel_description_en__chg_field_competencele.py b/curriculum/migrations/0009_auto__chg_field_competencelevel_description_en__chg_field_competencele.py new file mode 100644 index 0000000..4fbdde5 --- /dev/null +++ b/curriculum/migrations/0009_auto__chg_field_competencelevel_description_en__chg_field_competencele.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Changing field 'CompetenceLevel.description_en' + db.alter_column(u'curriculum_competencelevel', 'description_en', self.gf('django.db.models.fields.TextField')()) + + # Changing field 'CompetenceLevel.description_pl' + db.alter_column(u'curriculum_competencelevel', 'description_pl', self.gf('django.db.models.fields.TextField')()) + + # Changing field 'Section.name_en' + db.alter_column(u'curriculum_section', 'name_en', self.gf('django.db.models.fields.CharField')(max_length=255)) + + # Changing field 'Section.name_pl' + db.alter_column(u'curriculum_section', 'name_pl', self.gf('django.db.models.fields.CharField')(max_length=255)) + + # Changing field 'Competence.name_pl' + db.alter_column(u'curriculum_competence', 'name_pl', self.gf('django.db.models.fields.CharField')(max_length=255)) + + # Changing field 'Competence.name_en' + db.alter_column(u'curriculum_competence', 'name_en', self.gf('django.db.models.fields.CharField')(max_length=255)) + + # Changing field 'Level.name_pl' + db.alter_column(u'curriculum_level', 'name_pl', self.gf('django.db.models.fields.CharField')(max_length=255)) + + # Changing field 'Level.group_pl' + db.alter_column(u'curriculum_level', 'group_pl', self.gf('django.db.models.fields.CharField')(max_length=255)) + + # Changing field 'Level.group_en' + db.alter_column(u'curriculum_level', 'group_en', self.gf('django.db.models.fields.CharField')(max_length=255)) + + # Changing field 'Level.name_en' + db.alter_column(u'curriculum_level', 'name_en', self.gf('django.db.models.fields.CharField')(max_length=255)) + + def backwards(self, orm): + + # Changing field 'CompetenceLevel.description_en' + db.alter_column(u'curriculum_competencelevel', 'description_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'CompetenceLevel.description_pl' + db.alter_column(u'curriculum_competencelevel', 'description_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Section.name_en' + db.alter_column(u'curriculum_section', 'name_en', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + # Changing field 'Section.name_pl' + db.alter_column(u'curriculum_section', 'name_pl', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + # Changing field 'Competence.name_pl' + db.alter_column(u'curriculum_competence', 'name_pl', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + # Changing field 'Competence.name_en' + db.alter_column(u'curriculum_competence', 'name_en', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + # Changing field 'Level.name_pl' + db.alter_column(u'curriculum_level', 'name_pl', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + # Changing field 'Level.group_pl' + db.alter_column(u'curriculum_level', 'group_pl', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + # Changing field 'Level.group_en' + db.alter_column(u'curriculum_level', 'group_en', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + # Changing field 'Level.name_en' + db.alter_column(u'curriculum_level', 'name_en', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + models = { + u'curriculum.competence': { + 'Meta': {'ordering': "['section', 'order']", 'object_name': 'Competence'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name_en': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'section': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Section']"}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}) + }, + u'curriculum.competencelevel': { + 'Meta': {'ordering': "['competence', 'level']", 'object_name': 'CompetenceLevel'}, + 'competence': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Competence']"}), + 'description_en': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'description_pl': ('django.db.models.fields.TextField', [], {'default': "''"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Level']"}) + }, + u'curriculum.curriculum': { + 'Meta': {'object_name': 'Curriculum'}, + 'course': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumCourse']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.CurriculumLevel']"}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '16'}) + }, + u'curriculum.curriculumcourse': { + 'Meta': {'ordering': "['slug']", 'object_name': 'CurriculumCourse'}, + 'accusative': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'curriculum.curriculumlevel': { + 'Meta': {'object_name': 'CurriculumLevel'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) + }, + u'curriculum.level': { + 'Meta': {'ordering': "['order']", 'object_name': 'Level'}, + 'group_en': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + 'group_pl': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name_en': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + u'curriculum.section': { + 'Meta': {'ordering': "['order']", 'object_name': 'Section'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name_en': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}) + } + } + + complete_apps = ['curriculum'] \ No newline at end of file diff --git a/curriculum/models.py b/curriculum/models.py index ad98877..a3e2280 100644 --- a/curriculum/models.py +++ b/curriculum/models.py @@ -3,9 +3,9 @@ import re from django.core.urlresolvers import reverse from django.db import models from django.utils.translation import ugettext_lazy as _ +from fnpdjango.utils.models.translation import add_translatable class Section(models.Model): - name = models.CharField(_('name'), max_length=255) slug = models.SlugField(_('slug')) order = models.IntegerField(_('order')) @@ -23,10 +23,13 @@ class Section(models.Model): def url_for_level(self, level): return "%s?s=%d&level=%s&d=1" % (reverse("curriculum"), self.pk, level.slug) +add_translatable(Section, { + 'name': models.CharField(_('name'), max_length=255, default = '') +}) + class Competence(models.Model): section = models.ForeignKey(Section) - name = models.CharField(_('name'), max_length=255) slug = models.SlugField(_('slug')) order = models.IntegerField(_('order')) @@ -56,9 +59,12 @@ class Competence(models.Model): else: return cls.objects.get(name__iexact=parts[1].strip()) +add_translatable(Competence, { + 'name': models.CharField(_('name'), max_length=255, default = '') +}) + + class Level(models.Model): - group = models.CharField(_('group'), max_length=255) - name = models.CharField(_('name'), max_length=255) slug = models.CharField(_('slug'), max_length=255) order = models.IntegerField(_('order')) @@ -70,10 +76,15 @@ class Level(models.Model): def __unicode__(self): return self.name +add_translatable(Level, { + 'name': models.CharField(_('name'), max_length=255, default = ''), + 'group': models.CharField(_('group'), max_length=255, default = '') +}) + + class CompetenceLevel(models.Model): competence = models.ForeignKey(Competence) level = models.ForeignKey(Level) - description = models.TextField(_('description')) class Meta: ordering = ['competence', 'level'] @@ -86,6 +97,9 @@ class CompetenceLevel(models.Model): def get_absolute_url(self): return "%s?c=%d&level=%s&d=1" % (reverse("curriculum"), self.competence.pk, self.level.slug) +add_translatable(CompetenceLevel, { + 'description': models.TextField(_('description'), default = '') +}) class CurriculumLevel(models.Model):