From: Aleksander Łukasz Date: Tue, 22 Oct 2013 10:04:16 +0000 (+0200) Subject: Merge branch 'mil' into 'master' X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/736d94f6ac63f205be2967f013a15c457032fc2f?hp=42c42960c2dce4500f12dd14a68a10ed4f06abf5 Merge branch 'mil' into 'master' --- diff --git a/comment/__init__.py b/comment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/comment/admin.py b/comment/admin.py new file mode 100644 index 0000000..8b3cbd5 --- /dev/null +++ b/comment/admin.py @@ -0,0 +1,9 @@ +from django.contrib import admin + +from .models import CommentDocument + + +class CommentDocumentAdmin(admin.ModelAdmin): + prepopulated_fields = {"slug": ("name",)} + +admin.site.register(CommentDocument, CommentDocumentAdmin) diff --git a/comment/locale/pl/LC_MESSAGES/django.mo b/comment/locale/pl/LC_MESSAGES/django.mo new file mode 100644 index 0000000..435cc37 Binary files /dev/null and b/comment/locale/pl/LC_MESSAGES/django.mo differ diff --git a/comment/locale/pl/LC_MESSAGES/django.po b/comment/locale/pl/LC_MESSAGES/django.po new file mode 100644 index 0000000..767e39e --- /dev/null +++ b/comment/locale/pl/LC_MESSAGES/django.po @@ -0,0 +1,35 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-10-18 14:07+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" + +#: templates/comment/commentdocument_list.html:7 +#, python-format +msgid "" +"\n" +" Take part in the consultation by filling in the form or comment on specific competencies in different thematic " +"fields\n" +" " +msgstr "" +"\n" +" Weź udział w konsultacjach wypełniając ten " +"formularz lub skomentuj szczegółowo kompetencje w poszczególnych " +"obszarach tematycznych\n" +" " diff --git a/comment/migrations/0001_initial.py b/comment/migrations/0001_initial.py new file mode 100644 index 0000000..9bf33a5 --- /dev/null +++ b/comment/migrations/0001_initial.py @@ -0,0 +1,38 @@ +# -*- 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 model 'CommentDocument' + db.create_table(u'comment_commentdocument', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=255)), + ('comment_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + ('order', self.gf('django.db.models.fields.IntegerField')()), + )) + db.send_create_signal(u'comment', ['CommentDocument']) + + + def backwards(self, orm): + # Deleting model 'CommentDocument' + db.delete_table(u'comment_commentdocument') + + + models = { + u'comment.commentdocument': { + 'Meta': {'ordering': "['order']", 'object_name': 'CommentDocument'}, + 'comment_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}) + } + } + + complete_apps = ['comment'] \ No newline at end of file diff --git a/comment/migrations/0002_auto__add_field_commentdocument_language_code.py b/comment/migrations/0002_auto__add_field_commentdocument_language_code.py new file mode 100644 index 0000000..686f568 --- /dev/null +++ b/comment/migrations/0002_auto__add_field_commentdocument_language_code.py @@ -0,0 +1,34 @@ +# -*- 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 'CommentDocument.language_code' + db.add_column(u'comment_commentdocument', 'language_code', + self.gf('django.db.models.fields.CharField')(default='pl', max_length=2), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'CommentDocument.language_code' + db.delete_column(u'comment_commentdocument', 'language_code') + + + models = { + u'comment.commentdocument': { + 'Meta': {'ordering': "['order']", 'object_name': 'CommentDocument'}, + 'comment_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'language_code': ('django.db.models.fields.CharField', [], {'default': "'pl'", 'max_length': '2'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'order': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}) + } + } + + complete_apps = ['comment'] \ No newline at end of file diff --git a/comment/migrations/__init__.py b/comment/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/comment/models.py b/comment/models.py new file mode 100644 index 0000000..4cbabfa --- /dev/null +++ b/comment/models.py @@ -0,0 +1,19 @@ +from django.db import models +from django.core.urlresolvers import reverse + + +class CommentDocument(models.Model): + name = models.CharField(max_length = 255, unique = True) + slug = models.SlugField(max_length = 255, unique = True) + comment_id = models.CharField(max_length = 255, unique = True) + order = models.IntegerField() + language_code = models.CharField(max_length = 2, default = 'pl') + + class Meta: + ordering = ['order'] + + def __unicode__(self): + return self.name + + def get_absolute_url(self): + return reverse('comment_document', kwargs = dict(slug = self.slug)) diff --git a/comment/templates/comment/commentdocument_detail.html b/comment/templates/comment/commentdocument_detail.html new file mode 100644 index 0000000..2ab214b --- /dev/null +++ b/comment/templates/comment/commentdocument_detail.html @@ -0,0 +1,9 @@ +{% extends "base_mil.html" %} + +{% block body %} + +

{{object.name}}

+ + + +{% endblock %} \ No newline at end of file diff --git a/comment/templates/comment/commentdocument_list.html b/comment/templates/comment/commentdocument_list.html new file mode 100644 index 0000000..f7475a1 --- /dev/null +++ b/comment/templates/comment/commentdocument_list.html @@ -0,0 +1,17 @@ +{% extends "base_mil.html" %} +{% load i18n %} + + +{% block body %} + +

{% blocktrans with href=form_href %} + Take part in the consultation by filling in the form or comment on specific competencies in different thematic fields + {% endblocktrans %}:

+ +
    + {% for document in object_list %} +
  1. {{document.name}}
  2. + {% endfor %} +
+ +{% endblock %} \ No newline at end of file diff --git a/comment/urls.py b/comment/urls.py new file mode 100644 index 0000000..fcc7d99 --- /dev/null +++ b/comment/urls.py @@ -0,0 +1,9 @@ +from django.conf.urls import patterns, include, url + +from .views import CommentDocumentList, CommentDocument + + +urlpatterns = patterns('', + url('^$', CommentDocumentList.as_view(), name = 'comment_document_index'), + url('^(?P[^/]+)/$', CommentDocument.as_view(), name = 'comment_document') +) \ No newline at end of file diff --git a/comment/views.py b/comment/views.py new file mode 100644 index 0000000..1471029 --- /dev/null +++ b/comment/views.py @@ -0,0 +1,28 @@ +from django.views.generic import ListView, DetailView +from django.conf import settings +from django.utils.translation import get_language + +from django.core.urlresolvers import reverse + +from .models import CommentDocument + + +class CommentDocumentList(ListView): + model = CommentDocument + + def get_queryset(self, **kwargs): + return super(CommentDocumentList, self).get_queryset(**kwargs).filter(language_code = get_language()) + + def get_context_data(self, **kwargs): + context = super(CommentDocumentList, self).get_context_data(**kwargs) + context['form_href'] = reverse('contact_form', kwargs = dict(form_tag = 'mil')) + return context + + +class CommentDocument(DetailView): + model = CommentDocument + + def get_context_data(self, **kwargs): + context = super(CommentDocument, self).get_context_data(**kwargs) + context['comment_url'] = settings.COMMENT_URL + return context \ No newline at end of file diff --git a/contact/forms.py b/contact/forms.py index e369e95..8fa0149 100644 --- a/contact/forms.py +++ b/contact/forms.py @@ -62,8 +62,8 @@ class ContactForm(forms.Form): site = Site.objects.get_current() dictionary = { 'form_tag': self.form_tag, - 'site_name': site.name, - 'site_domain': site.domain, + 'site_name': getattr(self, 'site_name', site.name), + 'site_domain': getattr(self, 'site_domain', site.domain), 'contact': contact, } context = RequestContext(request) diff --git a/contact/templates/contact/form.html b/contact/templates/contact/form.html index 963742e..a9741f1 100644 --- a/contact/templates/contact/form.html +++ b/contact/templates/contact/form.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends form.base_template|default:"base.html" %} {% load chunks %} {% block title %}{{ form.form_title }}{% endblock %} diff --git a/contact/templates/contact/mail_managers_body.txt b/contact/templates/contact/mail_managers_body.txt index 5088b1b..b7f97cf 100644 --- a/contact/templates/contact/mail_managers_body.txt +++ b/contact/templates/contact/mail_managers_body.txt @@ -1,6 +1,6 @@ -{% load pretty_print from contact_tags %}Wypełniono formularz {{ form_tag }} na stronie {{ site_name }}. +{% load pretty_print from contact_tags %}{% load subdomainurls %}Wypełniono formularz {{ form_tag }} na stronie {{ site_name }}. -http://{{ site_domain }}{% url 'admin:contact_contact_change' contact.pk %} +{% url 'admin:contact_contact_change' None contact.pk %} {% for k, v in contact.body.items %} {{ k }}: diff --git a/contact/templates/contact/thanks.html b/contact/templates/contact/thanks.html index cc061ed..f82ebd8 100644 --- a/contact/templates/contact/thanks.html +++ b/contact/templates/contact/thanks.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends base_template|default:"base.html" %} {% load i18n %} {% block title %}{% trans "Thank you" %}{% endblock %} diff --git a/contact/views.py b/contact/views.py index 26ccf60..245433e 100644 --- a/contact/views.py +++ b/contact/views.py @@ -36,11 +36,14 @@ def form(request, form_tag): def thanks(request, form_tag): - if form_tag not in contact_forms: + try: + form_class = contact_forms[form_tag] + except KeyError: raise Http404 return render(request, - ['contact/%s/thanks.html' % form_tag, 'contact/thanks.html'] + ['contact/%s/thanks.html' % form_tag, 'contact/thanks.html'], + dict(base_template = getattr(form_class, 'base_template', None)) ) 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/locale/pl/LC_MESSAGES/django.mo b/curriculum/locale/pl/LC_MESSAGES/django.mo index 51d7de4..e26e73a 100644 Binary files a/curriculum/locale/pl/LC_MESSAGES/django.mo and b/curriculum/locale/pl/LC_MESSAGES/django.mo differ diff --git a/curriculum/locale/pl/LC_MESSAGES/django.po b/curriculum/locale/pl/LC_MESSAGES/django.po index 3c5d709..a9cdad2 100644 --- a/curriculum/locale/pl/LC_MESSAGES/django.po +++ b/curriculum/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-02-08 13:11+0100\n" +"POT-Creation-Date: 2013-10-18 14:01+0200\n" "PO-Revision-Date: 2013-02-08 13:16+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" @@ -15,23 +15,14 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2)\n" -#: models.py:8 -#: models.py:22 -#: models.py:47 -msgid "name" -msgstr "nazwa" - -#: models.py:9 -#: models.py:23 -#: models.py:48 +#: models.py:9 models.py:33 models.py:68 msgid "slug" msgstr "" -#: models.py:10 -#: models.py:24 -#: models.py:49 +#: models.py:10 models.py:34 models.py:69 msgid "order" msgstr "kolejność" @@ -43,59 +34,98 @@ msgstr "dział" msgid "sections" msgstr "działy" -#: models.py:28 +#: models.py:27 models.py:63 models.py:80 +msgid "name" +msgstr "nazwa" + +#: models.py:38 msgid "competence" msgstr "kompetencja" -#: models.py:29 +#: models.py:39 msgid "competences" msgstr "kompetencje" -#: models.py:46 -msgid "group" -msgstr "grupa" - -#: models.py:53 +#: models.py:73 msgid "educational level" msgstr "poziom edukacyjny" -#: models.py:54 +#: models.py:74 msgid "educational levels" msgstr "poziomy edukacyjne" -#: models.py:62 -msgid "description" -msgstr "opis" +#: models.py:81 +msgid "group" +msgstr "grupa" -#: models.py:66 +#: models.py:91 msgid "competence on level" msgstr "kompetencja na poziomie" -#: models.py:67 +#: models.py:92 msgid "competences on levels" msgstr "kompetencje na poziomach" -#: models.py:81 +#: models.py:101 +msgid "description" +msgstr "opis" + +#: models.py:109 msgid "curriculum level" msgstr "poziom w podstawie programowej" -#: models.py:82 +#: models.py:110 msgid "curriculum levels" msgstr "poziomy w podstawie programowej" -#: models.py:93 +#: models.py:122 msgid "curriculum course" msgstr "przedmiot w podstawie programowej" -#: models.py:94 +#: models.py:123 msgid "curriculum courses" msgstr "przedmioty w podstawie programowej" -#: models.py:111 +#: models.py:141 msgid "curriculum item" msgstr "pozycja w podstawie programowej" -#: models.py:112 +#: models.py:142 msgid "curriculum items" msgstr "podstawa programowa" +#: views.py:51 +msgid "You must select at least one competency from the list." +msgstr "Proszę wybrać kompetencje z listy." + +#: views.py:53 +msgid "You must select at least one education level." +msgstr "Proszę wybrać poziom edukacyjny." + +#: templates/curriculum/competence_list.html:8 +msgid "Media and information literacy competencies catalogue" +msgstr "Katalog kompetencji medialnych i informacyjnych" + +#: templates/curriculum/competence_list.html:15 +msgid "Browse competencies" +msgstr "Przeglądaj kompetencje" + +#: templates/curriculum/competence_list.html:15 +msgid "expand" +msgstr "rozwiń" + +#: templates/curriculum/competence_list.html:18 +msgid "Education level" +msgstr "Poziom edukacyjny" + +#: templates/curriculum/competence_list.html:31 +msgid "Competency categories" +msgstr "Kategories kompetencji" + +#: templates/curriculum/competence_list.html:49 +msgid "Show" +msgstr "Pokaż" + +#: templates/curriculum/competence_list.html:55 +msgid "Selected competencies" +msgstr "Wybrane kompetencje" 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): diff --git a/curriculum/templates/curriculum/competence_detail.html b/curriculum/templates/curriculum/competence_detail.html index 3a4bde4..20125ff 100755 --- a/curriculum/templates/curriculum/competence_detail.html +++ b/curriculum/templates/curriculum/competence_detail.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base_mil.html" %} {% block title %}{{ object }}{% endblock %} diff --git a/curriculum/templates/curriculum/competence_list.html b/curriculum/templates/curriculum/competence_list.html index 5597c8c..3009b49 100755 --- a/curriculum/templates/curriculum/competence_list.html +++ b/curriculum/templates/curriculum/competence_list.html @@ -1,18 +1,21 @@ -{% extends "base.html" %} +{% extends "base_mil.html" %} {% load chunks %} +{% load i18n %} -{% block title %}Katalog kompetencji medialnych i informacyjnych{% endblock %} +{% block title %}{% trans 'Media and information literacy competencies catalogue' %}{% endblock %} {% block body %} -

Katalog kompetencji medialnych i informacyjnych

+

{% trans 'Media and information literacy competencies catalogue' %}

-{% chunk 'katalog_kompetencji' %} +{% if request.LANGUAGE_CODE == 'pl' %} + {% chunk 'katalog_kompetencji' %} +{% endif %}
-

Przeglądaj kompetencje (rozwiń)

+

{% trans 'Browse competencies' %} ({% trans 'expand' %})

-

Poziom edukacyjny:

+

{% trans 'Education level' %}:

{% if errors.level %}

{{ errors.level }}

{% endif %} {% for lev_group, levels in levels.items %} {{ lev_group }} @@ -25,14 +28,14 @@ {% endfor %} -

Kategorie kompetencji:

+

{% trans 'Competency categories' %}:

{% if errors.competences %}

{{ errors.competences }}

{% endif %}
    {% for section in sections %}
  • - (rozwiń) + ({% trans 'expand' %})
      {% for competence in section.competence_set.all %}
    - +
{% if chosen_competences %} -

Wybrane kompetencje – {{ level }}

+

{% trans 'Selected competencies' %} – {{ level }}

{% for section, competences in chosen_competences.items %}

{{ section }}

diff --git a/curriculum/views.py b/curriculum/views.py index b643ae2..25606f1 100644 --- a/curriculum/views.py +++ b/curriculum/views.py @@ -2,6 +2,8 @@ from django.db import models from django.views.generic import DetailView, ListView from django.utils.datastructures import SortedDict +from django.utils.translation import ugettext as _ + from .models import Competence, Section, Level, CompetenceLevel @@ -46,9 +48,9 @@ class CompetencesView(ListView): if not (comp_ids or sect_ids): if level: - errors["competences"] = u"Proszę wybrać kompetencje z listy." + errors["competences"] = _('You must select at least one competency from the list.') elif level is None: - errors["level"] = u"Proszę wybrać poziom edukacyjny." + errors["level"] = _('You must select at least one education level.') else: chosen_competences = SortedDict() for competence in Competence.objects.filter( diff --git a/edumed/contact_forms.py b/edumed/contact_forms.py index 3ffdded..507c6d1 100644 --- a/edumed/contact_forms.py +++ b/edumed/contact_forms.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from django import forms from contact.forms import ContactForm +from django.utils.translation import ugettext_lazy as _ class RegistrationForm(ContactForm): @@ -127,3 +128,42 @@ class WTEMForm(ContactForm): required=False ) +class MILForm(ContactForm): + form_tag = 'mil' + form_title = _('Share your thoughts on the "Media and information literacy competencies catalogue"') + submit_label = _('Submit') + base_template = 'base_mil.html' + site_name = site_domain = 'katalog.nowoczesnapolska.org.pl' + + name = forms.CharField(label = _('Name and Surname'), max_length = 255) + contact = forms.EmailField(label = _('E-mail'), max_length = 255) + + institution = forms.CharField(label =_('Institution'), widget = forms.Textarea, max_length = 8192) + + question_stages = forms.CharField( + label = _('What do you think about the proposed educational stages classification?'), + widget = forms.Textarea, + max_length = 255, + required = False + ) + + question_fields = forms.CharField( + label = _('What do you think about the proposed thematic fields?'), + widget = forms.Textarea, + max_length = 255, + required = False + ) + + question_left_out = forms.CharField( + label = _('What important areas of media and information literacy have been left out?'), + widget = forms.Textarea, + max_length = 255, + required = False + ) + + other = forms.CharField( + label = _('Other suggestions and comments'), + widget = forms.Textarea, + max_length = 255, + required = False + ) diff --git a/edumed/locale/pl/LC_MESSAGES/django.mo b/edumed/locale/pl/LC_MESSAGES/django.mo index 6c2cbcf..455c60e 100644 Binary files a/edumed/locale/pl/LC_MESSAGES/django.mo and b/edumed/locale/pl/LC_MESSAGES/django.mo differ diff --git a/edumed/locale/pl/LC_MESSAGES/django.po b/edumed/locale/pl/LC_MESSAGES/django.po index 86361c7..2370fa9 100644 --- a/edumed/locale/pl/LC_MESSAGES/django.po +++ b/edumed/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-04 13:32+0200\n" +"POT-Creation-Date: 2013-10-18 15:07+0200\n" "PO-Revision-Date: 2012-11-19 15:58+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" @@ -15,14 +15,61 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2)\n" -#: templates/404.html:4 -#: templates/404.html.py:8 +#: contact_forms.py:133 +msgid "" +"Share your thoughts on the \"Media and information literacy competencies " +"catalogue\"" +msgstr "" +" Podziel się uwagami na temat Katalogu Kompetencji " + +#: contact_forms.py:134 +msgid "Submit" +msgstr "Zgłoś" + +#: contact_forms.py:138 +msgid "Name and Surname" +msgstr "Imię i nazwisko" + +#: contact_forms.py:139 +msgid "E-mail" +msgstr "Adres e-mail" + +#: contact_forms.py:141 +msgid "Institution" +msgstr "Instytucja" + +#: contact_forms.py:144 +msgid "What do you think about the proposed educational stages classification?" +msgstr "Co sądzisz o zaproponowanym podziale na etapy edukacyjne?" + +#: contact_forms.py:151 +msgid "What do you think about the proposed thematic fields?" +msgstr "Co sądzisz o zaproponowanym podziale na obszary tematyczne?" + +#: contact_forms.py:158 +msgid "" +"What important areas of media and information literacy have been left out?" +msgstr "" +"Jakie ważne obszary edukacji medialnej i informacyjnej zostały Twoim zdaniem " +"niewystarczająco pogłębione lub pominięto je w ogóle?" + +#: contact_forms.py:165 +msgid "Other suggestions and comments" +msgstr "Inne uwagi i sugestie" + +#: forms.py:11 +msgid "Signature" +msgstr "" + +#: templates/404.html:4 templates/404.html.py:8 templates/404_mil.html:4 +#: templates/404_mil.html.py:8 msgid "Page not found" msgstr "Strona nie znaleziona" -#: templates/404.html:11 +#: templates/404.html:11 templates/404_mil.html:11 msgid "The page you were looking for doesn't exist." msgstr "Strona której szukasz nie została znaleziona." @@ -30,3 +77,30 @@ msgstr "Strona której szukasz nie została znaleziona." msgid "Forum search" msgstr "Szukaj na forum" +#: templates/base_mil.html:8 +msgid "Consultations" +msgstr "Konsultacje" + +#: templates/base_mil.html:9 +msgid "Competencies" +msgstr "Kompetencje" + +#: templates/base_mil.html:10 +msgid "Take Part" +msgstr "Weź udział" + +#: templates/base_mil.html:14 +msgid "Contact" +msgstr "Kontakt" + +#: templates/pybb/_need_to_login_message.html:2 +msgid "Login" +msgstr "" + +#: templates/pybb/_need_to_login_message.html:2 +msgid "register" +msgstr "" + +#: templates/pybb/_need_to_login_message.html:2 +msgid "to create to post a reply" +msgstr "" diff --git a/edumed/milurls.py b/edumed/milurls.py new file mode 100644 index 0000000..3ad16c7 --- /dev/null +++ b/edumed/milurls.py @@ -0,0 +1,23 @@ +from django.conf.urls import include, url, patterns + +from fnpdjango.utils.urls import i18n_patterns +from .views import mil_home_view, mil_contact_view + + +urlpatterns = i18n_patterns('', + url(r'^$', mil_home_view, name="mil_home"), + url(r'^kompetencje/', include('curriculum.urls')), + url(r'^wez-udzial/', include('comment.urls')), + url(r'^zglos/', include('contact.urls')), + url(r'^kontakt/$', mil_contact_view, name='mil_contact') +) + +handler404 = 'edumed.views.mil_404_view' + +from django.conf import settings +if settings.DEBUG: + urlpatterns += patterns('', + url(r'^media/(?P.*)$', 'django.views.static.serve', { + 'document_root': settings.MEDIA_ROOT, + }), + ) diff --git a/edumed/settings.d/20-basic.py b/edumed/settings.d/20-basic.py index 3c900c8..9d0a384 100644 --- a/edumed/settings.d/20-basic.py +++ b/edumed/settings.d/20-basic.py @@ -23,6 +23,11 @@ TEMPLATE_LOADERS = ( ROOT_URLCONF = 'edumed.urls' +SUBDOMAIN_URLCONFS = { + None: 'edumed.urls', + 'katalog': 'edumed.milurls', +} + # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'edumed.wsgi.application' diff --git a/edumed/settings.d/30-apps.py b/edumed/settings.d/30-apps.py index 6a8d656..7091ff1 100644 --- a/edumed/settings.d/30-apps.py +++ b/edumed/settings.d/30-apps.py @@ -2,6 +2,7 @@ INSTALLED_APPS = ( 'edumed', 'curriculum', 'catalogue', + 'comment', 'fnpdjango', 'south', @@ -19,6 +20,7 @@ INSTALLED_APPS = ( 'pybb', 'django_libravatar', 'sorl.thumbnail', + 'subdomains', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/edumed/settings.d/30-locale.py b/edumed/settings.d/30-locale.py index 40f6617..ed2173a 100644 --- a/edumed/settings.d/30-locale.py +++ b/edumed/settings.d/30-locale.py @@ -2,7 +2,7 @@ LANGUAGES = ( ('pl', u'polski'), -# ('en', u'English'), + ('en', u'English'), ) # Local time zone for this installation. Choices can be found here: diff --git a/edumed/settings.d/40-middleware.py b/edumed/settings.d/40-middleware.py index b9c614d..998b707 100644 --- a/edumed/settings.d/40-middleware.py +++ b/edumed/settings.d/40-middleware.py @@ -3,6 +3,7 @@ MIDDLEWARE_CLASSES = tuple(x for x in ( 'django.contrib.sessions.middleware.SessionMiddleware' if "django.contrib.sessions" in INSTALLED_APPS else None, #'django.middleware.locale.LocaleMiddleware', + 'subdomains.middleware.SubdomainURLRoutingMiddleware', 'fnpdjango.middleware.URLLocaleMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/edumed/templates/404_mil.html b/edumed/templates/404_mil.html new file mode 100644 index 0000000..bdc4f15 --- /dev/null +++ b/edumed/templates/404_mil.html @@ -0,0 +1,14 @@ +{% extends "base_mil.html" %} +{% load i18n %} + +{% block title %}{% trans "Page not found" %}{% endblock %} + +{% block body %} + +

{% trans "Page not found" %}

+ +

+ {% trans "The page you were looking for doesn't exist." %} +

+ +{% endblock %} diff --git a/edumed/templates/base.html b/edumed/templates/base.html index 1c8f434..a30f6ab 100644 --- a/edumed/templates/base.html +++ b/edumed/templates/base.html @@ -1,105 +1,18 @@ - -{% load i18n static %} -{% load fnp_common fnp_share fnp_lang macros %} -{% load compressed static %} +{% extends "base_super.html" %} {% load sponsor_tags %} -{% macro title %}{% block title %}{% endblock %}{% endmacro %} -{% macro site_name %}Edukacja medialna{% endmacro %} - - - {% block full_title %}{% usemacro title %} :: {% usemacro site_name %}{% endblock %} - - {% compressed_css 'base' %} +{% block tagline %}Scenariusze zajęć, ćwiczenia, materiały{% endblock %} - - - - - - - - - - - -
-
- - {% if request.user.is_authenticated %} - Wyloguj - {% endif %} -
- -
- Projekt prowadzi:
- - Fundacja Nowoczesna Polska - -
- -
+{% block top_navigation %} +
  • Lekcje
  • +
  • Współpraca
  • +
  • Turniej
  • +
  • Wesprzyj nas
  • +
  • O nas
  • +
  • Kontakt
  • +{% endblock %} -
    Scenariusze zajęć, ćwiczenia, materiały
    - -
    -
    -
    - -
    {% block body %}{% endblock %}
    - -
    - {# chunks? #} - - - - {% sponsor_page "footer" %} -
    - -
    - - - {% compressed_js 'base' %} - {% block extra_script %}{% endblock %} - {{ piwik_tag|safe }} - - +{% block sponsors %} + {% sponsor_page "footer" %} +{% endblock %} \ No newline at end of file diff --git a/edumed/templates/base_mil.html b/edumed/templates/base_mil.html new file mode 100644 index 0000000..fbd42cb --- /dev/null +++ b/edumed/templates/base_mil.html @@ -0,0 +1,21 @@ +{% extends "base_super.html" %} +{% load subdomainurls %} +{% load fnp_lang %} +{% load sponsor_tags %} + +{% load i18n %} + +{% block top_navigation %} +
  • {% trans 'Consultations' %}
  • +
  • {% trans 'Competencies' %}
  • +
  • {% trans 'Take Part' %}
  • + {% if request.LANGUAGE_CODE == 'pl' %} +
  • Materiały edukacyjne
  • + {% endif %} +
  • {% trans 'Contact' %}
  • +
  • {% lang_switcher %}
  • +{% endblock %} + +{% block sponsors %} + {% sponsor_page "footer_mil" %} +{% endblock %} \ No newline at end of file diff --git a/edumed/templates/base_super.html b/edumed/templates/base_super.html new file mode 100644 index 0000000..211a6b7 --- /dev/null +++ b/edumed/templates/base_super.html @@ -0,0 +1,101 @@ + +{% load i18n static %} +{% load fnp_common fnp_share fnp_lang macros %} +{% load compressed static %} +{% load subdomainurls %} + +{% macro title %}{% block title %}{% endblock %}{% endmacro %} +{% macro site_name %}Edukacja medialna{% endmacro %} + + + + {% block full_title %}{% usemacro title %} :: {% usemacro site_name %}{% endblock %} + + {% compressed_css 'base' %} + + + + + + + + + + + + +
    +
    + + {% if request.user.is_authenticated %} + Wyloguj + {% endif %} +
    + +
    + Projekt prowadzi:
    + + Fundacja Nowoczesna Polska + +
    + +
    + +
    {% block tagline %}{% endblock %}
    + +
    +
    +
    + +
    {% block body %}{% endblock %}
    + +
    + {# chunks? #} + + + + {% block sponsors %} + {% endblock %} +
    + +
    + + + {% compressed_js 'base' %} + {% block extra_script %}{% endblock %} + {{ piwik_tag|safe }} + + diff --git a/edumed/templates/flatpages/mil.html b/edumed/templates/flatpages/mil.html new file mode 100644 index 0000000..5ac86a6 --- /dev/null +++ b/edumed/templates/flatpages/mil.html @@ -0,0 +1,10 @@ +{% extends "base_mil.html" %} +{% load textile_pl from fnp_markup %} + +{% block title %}{{ flatpage.title }}{% endblock %} + +{% block body %} +
    +{{ flatpage.content|textile_pl }} +
    +{% endblock %} diff --git a/edumed/templates/home_mil.html b/edumed/templates/home_mil.html new file mode 100644 index 0000000..5811963 --- /dev/null +++ b/edumed/templates/home_mil.html @@ -0,0 +1,5 @@ +{% extends "base_mil.html" %} + +{% block body %} +mil +{% endblock %} diff --git a/edumed/urls.py b/edumed/urls.py index ff55310..af3cb28 100644 --- a/edumed/urls.py +++ b/edumed/urls.py @@ -6,7 +6,6 @@ from .views import HomeView, AvatarlessProfileEditView urlpatterns = patterns('', url(r'^$', HomeView.as_view(), name="home"), - url(r'^kompetencje/', include('curriculum.urls')), url(r'^lekcje/', include('catalogue.urls')), url(r'^info/(?P.*)$', 'django.contrib.flatpages.views.flatpage', name="info"), diff --git a/edumed/views.py b/edumed/views.py index bde67ef..a6c1aa6 100755 --- a/edumed/views.py +++ b/edumed/views.py @@ -1,6 +1,8 @@ import os.path from django.conf import settings from django.views.generic import TemplateView +from django.views.defaults import page_not_found +from django.contrib.flatpages.views import flatpage from pybb.views import ProfileEditView from .forms import AvatarlessEditProfileForm @@ -14,5 +16,15 @@ class HomeView(TemplateView): context['package_student_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE_STUDENT) return context + +def mil_home_view(request): + return flatpage(request, url = '/' if request.LANGUAGE_CODE == 'pl' else '/en/') + +def mil_404_view(request): + return page_not_found(request, '404_mil.html') + +def mil_contact_view(request): + return flatpage(request, url = '/kontakt_mil/' if request.LANGUAGE_CODE == 'pl' else '/contact_mil/') + class AvatarlessProfileEditView(ProfileEditView): form_class = AvatarlessEditProfileForm diff --git a/requirements.txt b/requirements.txt index 49b1e28..1a8d1d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,3 +35,4 @@ django-libravatar sorl-thumbnail>=11,<12 pyyaml +django-subdomains>=2.0.4,<2.1