Obálkování: řazení řešitelů v databázi
This commit is contained in:
parent
1748355b0c
commit
1a9728501d
1 changed files with 14 additions and 3 deletions
|
@ -459,11 +459,22 @@ def obalkovaniView(request, rocnik, cislo):
|
|||
rocnik = Rocnik.objects.get(rocnik=rocnik)
|
||||
cislo = Cislo.objects.get(rocnik=rocnik, cislo=cislo)
|
||||
|
||||
reseni = Reseni.objects.filter(cislo_body=cislo)
|
||||
serazena_reseni = sorted(reseni, key=lambda r: (r.resitel.prijmeni, r.resitel.jmeno, r.problem.typ, r.problem.kod))
|
||||
reseni = (
|
||||
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))
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue