Browse Source

Obálkování: řazení řešitelů v databázi

remotes/origin/bug
Matěj Kocián 9 years ago
parent
commit
1a9728501d
  1. 17
      seminar/views.py

17
seminar/views.py

@ -459,11 +459,22 @@ def obalkovaniView(request, rocnik, cislo):
rocnik = Rocnik.objects.get(rocnik=rocnik) rocnik = Rocnik.objects.get(rocnik=rocnik)
cislo = Cislo.objects.get(rocnik=rocnik, cislo=cislo) cislo = Cislo.objects.get(rocnik=rocnik, cislo=cislo)
reseni = Reseni.objects.filter(cislo_body=cislo) reseni = (
serazena_reseni = sorted(reseni, key=lambda r: (r.resitel.prijmeni, r.resitel.jmeno, r.problem.typ, r.problem.kod)) Reseni.objects.filter(cislo_body=cislo)
.order_by(
'resitel__prijmeni',
'resitel__jmeno',
'problem__typ',
'problem__kod'
)
)
problemy = sorted(set(r.problem for r in reseni), key=lambda p: (p.typ, p.kod)) problemy = sorted(set(r.problem for r in reseni), key=lambda p: (p.typ, p.kod))
return render(request, 'seminar/archiv/cislo_obalkovani.html', {'cislo': cislo, 'problemy': problemy, 'reseni': serazena_reseni}) return render(
request,
'seminar/archiv/cislo_obalkovani.html',
{'cislo': cislo, 'problemy': problemy, 'reseni': reseni}
)
### Tituly ### Tituly

Loading…
Cancel
Save