nicer curriculum errors
[edumed.git] / curriculum / views.py
index 32e91e0..b643ae2 100644 (file)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8
 from django.db import models
 from django.views.generic import DetailView, ListView
 from django.utils.datastructures import SortedDict
@@ -13,7 +14,11 @@ class CompetencesView(ListView):
 
     def get_context_data(self, **kwargs):
         context = super(CompetencesView, self).get_context_data(**kwargs)
-        context['levels'] = Level.objects.all()
+        
+        context['levels'] = SortedDict()
+        for level in Level.objects.all():
+            context['levels'].setdefault(level.group, []).append(level)
+
         context['sections'] = Section.objects.all()
 
         errors = {}
@@ -41,9 +46,9 @@ class CompetencesView(ListView):
 
         if not (comp_ids or sect_ids):
             if level:
-                errors["competences"] = "Please!"
+                errors["competences"] = u"Proszę wybrać kompetencje z listy."
         elif level is None:
-            errors["level"] = "Please!"
+            errors["level"] = u"Proszę wybrać poziom edukacyjny."
         else:
             chosen_competences = SortedDict()
             for competence in Competence.objects.filter(