from django.db import models
from django.views.generic import DetailView, ListView
from django.utils.datastructures import SortedDict
from django.db import models
from django.views.generic import DetailView, ListView
from django.utils.datastructures import SortedDict
def get_context_data(self, **kwargs):
context = super(CompetencesView, self).get_context_data(**kwargs)
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)
+