Status: stav a jmena resitelu (dle pohlavi)
This commit is contained in:
parent
048282689b
commit
f776c4aef2
3 changed files with 27 additions and 1 deletions
|
@ -4,6 +4,14 @@
|
||||||
<div>
|
<div>
|
||||||
<h2>Stav databáze</h2>
|
<h2>Stav databáze</h2>
|
||||||
|
|
||||||
|
<h3>Řešitelé</h3>
|
||||||
|
|
||||||
|
<div>Řešitelů: {{ resitele |length}} ({{ muzi |length}} mužů, {{ zeny |length}} žen)</div>
|
||||||
|
<div>Křestní jména mužů:</div>
|
||||||
|
<p><code>{% for n, c in jmena_muzu.items %}{{ n }} ({{ c }}), {% endfor %}</code>
|
||||||
|
<div>Křestní jména žen:</div>
|
||||||
|
<p><code>{% for n, c in jmena_zen.items %}{{ n }} ({{ c }}), {% endfor %}</code>
|
||||||
|
|
||||||
<h3>Nastavení</h3>
|
<h3>Nastavení</h3>
|
||||||
|
|
||||||
<h3>Problémy</h3>
|
<h3>Problémy</h3>
|
||||||
|
|
|
@ -2,6 +2,16 @@
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
|
def histogram(seznam):
|
||||||
|
d = {}
|
||||||
|
for i in seznam:
|
||||||
|
if i not in d:
|
||||||
|
d[i] = 0
|
||||||
|
d[i] += 1
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
roman_numerals = zip((1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1),
|
roman_numerals = zip((1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1),
|
||||||
('M', 'CM', 'D', 'CD','C', 'XC','L','XL','X','IX','V','IV','I'))
|
('M', 'CM', 'D', 'CD','C', 'XC','L','XL','X','IX','V','IV','I'))
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.views import generic
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
|
||||||
from .models import Problem, Cislo, Reseni, VysledkyKCislu, Nastaveni, Rocnik, Soustredeni, Organizator
|
from .models import Problem, Cislo, Reseni, VysledkyKCislu, Nastaveni, Rocnik, Soustredeni, Organizator, Resitel
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
def AktualniZadaniView(request):
|
def AktualniZadaniView(request):
|
||||||
|
@ -167,8 +167,16 @@ class SoustredeniView(generic.DetailView):
|
||||||
def StavDatabazeView(request):
|
def StavDatabazeView(request):
|
||||||
# nastaveni = Nastaveni.objects.get()
|
# nastaveni = Nastaveni.objects.get()
|
||||||
problemy = utils.seznam_problemu()
|
problemy = utils.seznam_problemu()
|
||||||
|
muzi = Resitel.objects.filter(pohlavi_muz=True)
|
||||||
|
zeny = Resitel.objects.filter(pohlavi_muz=False)
|
||||||
return render(request, 'seminar/stav_databaze.html',
|
return render(request, 'seminar/stav_databaze.html',
|
||||||
{
|
{
|
||||||
# 'nastaveni': nastaveni,
|
# 'nastaveni': nastaveni,
|
||||||
'problemy': problemy,
|
'problemy': problemy,
|
||||||
|
|
||||||
|
'resitele': Resitel.objects.all(),
|
||||||
|
'muzi': muzi,
|
||||||
|
'zeny': zeny,
|
||||||
|
'jmena_muzu': utils.histogram([r.jmeno for r in muzi]),
|
||||||
|
'jmena_zen': utils.histogram([r.jmeno for r in zeny]),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue