X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/85d58d864e0eab34f5dfdb6ed5a05b5faf7970ed..068d95bd6f8b28031a9e5236dbec460aad44ae7a:/curriculum/views.py?ds=inline diff --git a/curriculum/views.py b/curriculum/views.py index 32e91e0..25606f1 100644 --- a/curriculum/views.py +++ b/curriculum/views.py @@ -1,6 +1,9 @@ +# -*- coding: utf-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 @@ -13,7 +16,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 +48,9 @@ class CompetencesView(ListView): if not (comp_ids or sect_ids): if level: - errors["competences"] = "Please!" + errors["competences"] = _('You must select at least one competency from the list.') elif level is None: - errors["level"] = "Please!" + errors["level"] = _('You must select at least one education level.') else: chosen_competences = SortedDict() for competence in Competence.objects.filter(