diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 84abd9cd..0925a22e 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -18,7 +18,7 @@ SITE_ID = 1 ROOT_URLCONF = 'mamweb.urls' WSGI_APPLICATION = 'mamweb.wsgi.application' -APPEND_SLASH = False +APPEND_SLASH = True # Internationalization # https://docs.djangoproject.com/en/1.7/topics/i18n/ diff --git a/mamweb/static/css/bootstrap.css b/mamweb/static/css/bootstrap.css index 3c503e69..bd20fe85 100644 --- a/mamweb/static/css/bootstrap.css +++ b/mamweb/static/css/bootstrap.css @@ -1403,11 +1403,11 @@ pre code { width: 970px; } } -@media (min-width: 1200px) { +/*@media (min-width: 1200px) { .container { width: 1170px; } -} +}*/ .container-fluid { padding-right: 15px; padding-left: 15px; @@ -1896,7 +1896,7 @@ pre code { margin-left: 0; } } -@media (min-width: 1200px) { +/*@media (min-width: 1200px) { .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { float: left; } @@ -2053,7 +2053,7 @@ pre code { .col-lg-offset-0 { margin-left: 0; } -} +}*/ table { background-color: transparent; } @@ -6232,7 +6232,7 @@ button.close { display: inline-block !important; } } -@media (min-width: 1200px) { +/*@media (min-width: 1200px) { .visible-lg { display: block !important; } @@ -6261,7 +6261,7 @@ button.close { .visible-lg-inline-block { display: inline-block !important; } -} +}*/ @media (max-width: 767px) { .hidden-xs { display: none !important; @@ -6277,11 +6277,11 @@ button.close { display: none !important; } } -@media (min-width: 1200px) { +/*@media (min-width: 1200px) { .hidden-lg { display: none !important; } -} +}*/ .visible-print { display: none !important; } diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 9c2f0a6a..c1ee8bad 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -33,6 +33,18 @@ table .border-b { border: solid 2px; } +div.container { + background-color: #fff8eb; + padding: 0px; +} + +div.content { + padding: 15px 30px; +} + +h2 { + margin-top: 0px; +} /* Comments */ @@ -43,36 +55,17 @@ table .border-b { /* Headline & Header */ -#headline { - padding: 6px 10px; - font-size: 150%; - font-weight: 400; - background: #00c322; /* @mamgreen */ -} - #header { position: relative; - z-index: -1; -} - -.header-lg { - font-size: 250%; - background-color: rgba(255,195,0,0.8); - height: 220px; - position: relative; -} -.header-md { - font-size: 250%; - background-color: rgba(255,195,0,0.8); - height: 220px; - position: relative; + font-size: 250%; + background: url("../images/header-bg.png") no-repeat left top; + height: 353px; + top: -1px; } - #header img.logo { position: absolute; - top: 25px; - left: 25px; - height: 110px; + top: 20px; + left: 45px; } #header h1 { font-size: 130%; @@ -91,9 +84,10 @@ table .border-b { /* Menu */ #menu { - background: #00c322; /* @mamgreen */ - border-bottom-left-radius: 8px; - border-bottom-right-radius: 8px; + position: relative; + top: -1px; + background: url("../images/menu-bg-vertical.png") no-repeat left top, url("../images/menu-bg-horizontal.png") repeat-x left top; + background-color: #ffb52d; } #menu ul { padding: 0px; @@ -117,36 +111,41 @@ table .border-b { #menu a { display: block; padding: 8px 10px; - color: black; + color: #006400; } #menu a:hover { - background: #ffb000; - border-bottom-left-radius: 8px; - border-bottom-right-radius: 8px; + background: url("../images/submenu-bg-vertical.png") no-repeat left top, url("../images/submenu-bg-horizontal.png") repeat-x left top; + background-color: #ffa500; text-decoration: none; + color: #003c00; +} +#menu a.selected { + color: #003c00; } #submenu { - /*border: 1px solid black;*/ + position: relative; + top: -1px; + background: url("../images/submenu-bg-vertical.png") no-repeat left top, url("../images/submenu-bg-horizontal.png") repeat-x left top; + background-color: #ffa500; } #submenu ul { - padding: 0px 0px; - margin: 20px 0px 20px 0px; - background: #00c322; /* @mamgreen */ - border-radius: 8px; - list-style-position: inside; - width: 100%; + padding: 0px 15px; + font-size: 150%; + font-weight: 400; } #submenu li { - border-radius: 0px; - padding: 6px 15px; - margin-right: 0px; - font-size: 120%; + padding: 6px 20px; + display: inline-block; +} +#submenu li>a { + color: #003c00; + text-decoration: none; } -#submenu li:hover { - background: #ffb000; +#submenu li>a:hover { + color: #3c003c; } -#submenu li:first-child { +/*#submenu li:first-child { border-top-left-radius: 7px; border-top-right-radius: 7px; padding-top: 8px; @@ -156,9 +155,6 @@ table .border-b { border-bottom-right-radius: 7px; padding-bottom: 8px; } -#submenu li>a { - color: #000; -} #submenu li>a:hover { text-decoration: none; -} +}*/ diff --git a/mamweb/static/images/header-bg.png b/mamweb/static/images/header-bg.png new file mode 100644 index 00000000..eeb35d6b Binary files /dev/null and b/mamweb/static/images/header-bg.png differ diff --git a/mamweb/static/images/logo.png b/mamweb/static/images/logo.png new file mode 100644 index 00000000..1af2dd66 Binary files /dev/null and b/mamweb/static/images/logo.png differ diff --git a/mamweb/static/images/menu-bg-horizontal.png b/mamweb/static/images/menu-bg-horizontal.png new file mode 100644 index 00000000..f746bef3 Binary files /dev/null and b/mamweb/static/images/menu-bg-horizontal.png differ diff --git a/mamweb/static/images/menu-bg-vertical.png b/mamweb/static/images/menu-bg-vertical.png new file mode 100644 index 00000000..767752cc Binary files /dev/null and b/mamweb/static/images/menu-bg-vertical.png differ diff --git a/mamweb/static/images/submenu-bg-horizontal.png b/mamweb/static/images/submenu-bg-horizontal.png new file mode 100644 index 00000000..1d7001aa Binary files /dev/null and b/mamweb/static/images/submenu-bg-horizontal.png differ diff --git a/mamweb/static/images/submenu-bg-vertical.png b/mamweb/static/images/submenu-bg-vertical.png new file mode 100644 index 00000000..11537ee1 Binary files /dev/null and b/mamweb/static/images/submenu-bg-vertical.png differ diff --git a/mamweb/templates/404.html b/mamweb/templates/404.html index b119dff5..485896d0 100644 --- a/mamweb/templates/404.html +++ b/mamweb/templates/404.html @@ -3,7 +3,12 @@ {% load staticfiles %} {% block content %} -

{% block nadpis1 %}Požadovaná stránka nenalezena{% endblock%}

+

+ {% block nadpis1a %}{% block nadpis1b %} + Požadovaná stránka nenalezena + {% endblock %}{% endblock%} +

+

Tuto stránku jsme na našem servru nenalezli. Zkuste přejít na titulní stránku diff --git a/mamweb/templates/500.html b/mamweb/templates/500.html index 8072c7a1..6c1c7b93 100644 --- a/mamweb/templates/500.html +++ b/mamweb/templates/500.html @@ -3,7 +3,12 @@ {% load staticfiles %} {% block content %} -

{% block nadpis1 %}O-jo-jo-jo-joj{% endblock %}

+

+ {% block nadpis1a %}{% block nadpis1b %} + O-jo-jo-jo-joj + {% endblock %}{% endblock %} +

+

Chybička se vloudila. Zkuste přejít na titulní stránku diff --git a/mamweb/templates/base.html b/mamweb/templates/base.html index e4bb4af4..05063dbc 100644 --- a/mamweb/templates/base.html +++ b/mamweb/templates/base.html @@ -16,10 +16,22 @@ + {# nastavení MathJaxu, aby nahrazoval i matiku obalenou jednoduchými $ #} + + + - - {# TODO predelat pro pouze pro orgy (misto pro prihlasene) #} - {% if user.is_authenticated %} + + {% if user.is_staff %}

{% if view.object %} Objekt {{ view.object }}: {{ view.object }} @@ -35,48 +47,44 @@
-
- Studentský korespondenční seminář a časopis MFF UK -
-
-
-
-
- -
+ + + +
-
- -
-
- {% block content %} - {% endblock content %} -
-
+
+ +
+
+
+
+ {% block content %} + {% endblock content %} +
+
diff --git a/mamweb/templates/flatpages/default.html b/mamweb/templates/flatpages/default.html index 4f0cbfa6..d90bab4b 100644 --- a/mamweb/templates/flatpages/default.html +++ b/mamweb/templates/flatpages/default.html @@ -3,27 +3,102 @@ {% block title %}{{ flatpage.title }}{% endblock title %} {% block content %} -

{% block nadpis1 %}{{ flatpage.title }}{% endblock %}

+

+ {% block nadpis1a %}{% block nadpis1b%} + {{ flatpage.title }} + {% endblock %}{% endblock %} +

+
{{ flatpage.content }}
{% endblock content %} +{# nahraj spravne submenu #} {% block submenu %} + {# co-je-MaM #} {% if "/co-je-MaM/" in flatpage.url %} - {% include "seminar/cojemam/submenu.html" %} + {% if "/uvod/" in flatpage.url %} + {% with "uvod" as selected %} + {% include "seminar/cojemam/submenu.html" %} + {% endwith %} + {% elif "jak-resit" in flatpage.url %} + {% with "jak-resit" as selected %} + {% include "seminar/cojemam/submenu.html" %} + {% endwith %} + {% elif "FAQ" in flatpage.url %} + {% with "FAQ" as selected %} + {% include "seminar/cojemam/submenu.html" %} + {% endwith %} + {% else %} + {% include "seminar/cojemam/submenu.html" %} + {% endif %} {% endif %} + {# soustredeni #} {% if "/soustredeni/" in flatpage.url %} - {% include "seminar/soustredeni/submenu.html" %} + {% if "/pripravujeme/" in flatpage.url %} + {% with "pripravujeme" as selected %} + {% include "seminar/soustredeni/submenu.html" %} + {% endwith %} + {% else %} + {% with "uvod" as selected %} + {% include "seminar/soustredeni/submenu.html" %} + {% endwith %} + {% endif %} {% endif %} + {# zadani #} {% if "/zadani/" in flatpage.url %} - {% include "seminar/zadani/submenu.html" %} + {% if "/ulohy/" in flatpage.url %} + {% with "ulohy" as selected %} + {% include "seminar/zadani/submenu.html" %} + {% endwith %} + {% elif "/aktualni-cislo/" in flatpage.url %} + {% with "aktualni-cislo" as selected %} + {% include "seminar/zadani/submenu.html" %} + {% endwith %} + {% elif "/vysledkove-listiny/" in flatpage.url %} + {% with "vysledkove-listiny" as selected %} + {% include "seminar/zadani/submenu.html" %} + {% endwith %} + {% else %} + {% include "seminar/zadani/submenu.html" %} + {% endif %} {% endif %} + {# clanky #} {% if "/clanky/" in flatpage.url %} - {% include "seminar/clanky/submenu.html" %} + {% if "/uvod/" in flatpage.url %} + {% with "uvod" as selected %} + {% include "seminar/clanky/submenu.html" %} + {% endwith %} + {% elif "/org/" in flatpage.url %} + {% with "org" as selected %} + {% include "seminar/clanky/submenu.html" %} + {% endwith %} + {% elif "/resitel/" in flatpage.url %} + {% with "resitel" as selected %} + {% include "seminar/clanky/submenu.html" %} + {% endwith %} + {% else %} + {% include "seminar/clanky/submenu.html" %} + {% endif %} {% endif %} + {# archiv #} {% if "/archiv/" in flatpage.url %} - {% include "seminar/archiv/submenu.html" %} + {% if "/ulohy/" in flatpage.url %} + {% with "ulohy" as selected %} + {% include "seminar/archiv/submenu.html" %} + {% endwith %} + {% else %} + {% include "seminar/archiv/submenu.html" %} + {% endif %} {% endif %} {% endblock %} +{# zvirazneni menu #} +{% block menu_uvod %}{% if "/co-je-MaM/" in flatpage.url %}selected{% endif %}{% endblock %} +{% block menu_soustredeni %}{% if "/soustredeni/" in flatpage.url %}selected{% endif %}{% endblock %} +{% block menu_zadani %}{% if "/zadani/" in flatpage.url %}selected{% endif %}{% endblock %} +{% block menu_clanky %}{% if "/clanky/" in flatpage.url %}selected{% endif %}{% endblock %} +{% block menu_archiv %}{% if "/archiv/" in flatpage.url %}selected{% endif %}{% endblock %} + +{# TODO zvirazneni submenu #} diff --git a/seminar/admin.py b/seminar/admin.py index 6c40bb8c..eeb415ac 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -360,8 +360,34 @@ class NovinkyAdminForm(forms.ModelForm): model = Novinky exclude = [] +def zverejnit_novinky(modeladmin, request, queryset): + ''' zverejni vybrane novinky ''' + for novinka in queryset: + novinka.zverejneno = True + novinka.save() + zverejnit_novinky.short_description = 'Zveřejnit vybané novinky' + +def zneverejnit_novinky(modeladmin, request, queryset): + ''' zneverejni vybrane novinky''' + for novinka in queryset: + novinka.zverejneno = False + novinka.save() + zneverejnit_novinky.short_description = 'Zneveřejnit vybrané novinky' + + class NovinkyAdmin(admin.ModelAdmin): form = NovinkyAdminForm + list_display = ['datum', 'autor', 'text', 'zverejneno', 'obrazek'] + actions = [zverejnit_novinky, zneverejnit_novinky] + + # předvyplnění přihlášeného uživatele jako autora novinky + def formfield_for_foreignkey(self, db_field, request, **kwargs): + if db_field.name == 'autor': + kwargs['initial'] = request.user.id + return super(NovinkyAdmin, self).formfield_for_foreignkey( + db_field, request, **kwargs + ) + admin.site.register(Novinky, NovinkyAdmin) diff --git a/seminar/models.py b/seminar/models.py index d39d735f..86b2061a 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -453,6 +453,9 @@ class Problem(SeminarModelBase): return force_unicode(u"t%s" % (self.kod,)) return '' + def nazev_typu(self): + return dict(self.TYP_CHOICES)[self.typ] + def verejne(self): return (self.cislo_zadani and self.cislo_zadani.verejne()) verejne.boolean = True @@ -466,6 +469,9 @@ class Problem(SeminarModelBase): else: return reverse('admin:seminar_problemnavrh_change', args=(self.id, )) + def body_v_zavorce(self): + return u"({}\u2009b)".format(self.body) if self.body else "" + @reversion.register(ignore_duplicate_revisions=True) @python_2_unicode_compatible @@ -756,7 +762,7 @@ class Organizator(models.Model): null = True, blank = True) foto = models.ImageField('Fotografie organizátora', upload_to='image_organizatori/velke/%Y/', null = True, blank = True, - help_text = 'Vlož fotografii organizátora o libovoné velikosti') + help_text = 'Vlož fotografii organizátora o libovolné velikosti') foto_male = models.ImageField(upload_to='image_organizatori/male/%Y/', null = True, blank = True, editable = False) diff --git a/seminar/templates/seminar/archiv/base.html b/seminar/templates/seminar/archiv/base.html index 2eb6110a..e972c130 100644 --- a/seminar/templates/seminar/archiv/base.html +++ b/seminar/templates/seminar/archiv/base.html @@ -1,6 +1,4 @@ {% extends "base.html" %} -{% block submenu %} - {% include "seminar/archiv/submenu.html" %} -{% endblock %} +{% block menu_archiv %}selected{% endblock %} diff --git a/seminar/templates/seminar/archiv/base_cisla.html b/seminar/templates/seminar/archiv/base_cisla.html new file mode 100644 index 00000000..deb371eb --- /dev/null +++ b/seminar/templates/seminar/archiv/base_cisla.html @@ -0,0 +1,8 @@ +{% extends "seminar/archiv/base.html" %} + +{% block submenu %} + {% with "cisla" as selected %} + {% include "seminar/archiv/submenu.html" %} + {% endwith %} +{% endblock %} + diff --git a/seminar/templates/seminar/archiv/base_temata.html b/seminar/templates/seminar/archiv/base_temata.html new file mode 100644 index 00000000..47089bbf --- /dev/null +++ b/seminar/templates/seminar/archiv/base_temata.html @@ -0,0 +1,8 @@ +{% extends "seminar/archiv/base.html" %} + +{% block submenu %} + {% with "temata" as selected %} + {% include "seminar/archiv/submenu.html" %} + {% endwith %} +{% endblock %} + diff --git a/seminar/templates/seminar/archiv/base_ulohy.html b/seminar/templates/seminar/archiv/base_ulohy.html new file mode 100644 index 00000000..0dcd546a --- /dev/null +++ b/seminar/templates/seminar/archiv/base_ulohy.html @@ -0,0 +1,10 @@ +{% extends "seminar/archiv/base.html" %} + +{% block menu_archiv %}selected{% endblock %} + +{% block submenu %} + {% with "ulohy" as selected %} + {% include "seminar/archiv/submenu.html" %} + {% endwith %} +{% endblock %} + diff --git a/seminar/templates/seminar/archiv/cisla.html b/seminar/templates/seminar/archiv/cisla.html index c5ab25f7..bacb5e67 100644 --- a/seminar/templates/seminar/archiv/cisla.html +++ b/seminar/templates/seminar/archiv/cisla.html @@ -1,12 +1,12 @@ -{% extends "seminar/archiv/base.html" %} - -{% block submenu %} - {% include "seminar/archiv/submenu.html" %} -{% endblock %} +{% extends "seminar/archiv/base_cisla.html" %} {% block content %}
-

{% block nadpis1 %}Archiv čísel {% endblock %}

+

+ {% block nadpis1a %}{% block nadpis1b %} + Archiv čísel + {% endblock %}{% endblock %} +

+ {% if temata_v_rocniku %} +

Témata

+ + {% endif %} + {% if vysledkovka %}

Výsledkovka

@@ -30,11 +43,15 @@ {% for rv in vysledkovka %} -
{{ rv.poradi }} - {{ rv.resitel.titul }} MM {{ rv.resitel.plne_jmeno }} + {% autoescape off %}{{ rv.poradi }}{% endautoescape %} + + {% if rv.titul %} + {{ rv.titul }}MM + {% endif %} + {{ rv.resitel.plne_jmeno }} {{ rv.resitel.rocnik }} {{ rv.body_odjakziva }} - {% for b in rv.body %} + {% for b in rv.body_cisla %} {{ b }} {% endfor %} {{ rv.body_rocnik }} diff --git a/seminar/templates/seminar/archiv/submenu.html b/seminar/templates/seminar/archiv/submenu.html index fb0bd921..234a0f7c 100644 --- a/seminar/templates/seminar/archiv/submenu.html +++ b/seminar/templates/seminar/archiv/submenu.html @@ -1,9 +1,9 @@ {% with "/archiv" as cesta %} {% endwith %} diff --git a/seminar/templates/seminar/archiv/temata.html b/seminar/templates/seminar/archiv/temata.html new file mode 100644 index 00000000..44e40ef2 --- /dev/null +++ b/seminar/templates/seminar/archiv/temata.html @@ -0,0 +1,23 @@ +{% extends "seminar/archiv/base_temata.html" %} + +{% block content %} +

+ {% block nadpis1a %}{% block nadpis1b %} + Archiv témat + {% endblock %}{% endblock%} +

+ + {% for tema in object_list %} + {% with tema.cislo_zadani.rocnik.rocnik as rocnik %} + {% ifchanged rocnik %} + {% if not forloop.first %}{% endif %} +

{{ rocnik }}. ročník

+ + +{% endblock content %} diff --git a/seminar/templates/seminar/clanky/base.html b/seminar/templates/seminar/clanky/base.html index 8698808e..45c022aa 100644 --- a/seminar/templates/seminar/clanky/base.html +++ b/seminar/templates/seminar/clanky/base.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block menu_clanky %}selected{% endblock %} + {% block submenu %} {% include "seminar/clanky/submenu.html" %} {% endblock %} diff --git a/seminar/templates/seminar/clanky/submenu.html b/seminar/templates/seminar/clanky/submenu.html index ee6ebcdc..e909c7f1 100644 --- a/seminar/templates/seminar/clanky/submenu.html +++ b/seminar/templates/seminar/clanky/submenu.html @@ -1,9 +1,9 @@ {% with "/clanky" as cesta %} {% endwith %} diff --git a/seminar/templates/seminar/cojemam/organizatori.html b/seminar/templates/seminar/cojemam/organizatori.html index 2d2ab12f..f384dc10 100644 --- a/seminar/templates/seminar/cojemam/organizatori.html +++ b/seminar/templates/seminar/cojemam/organizatori.html @@ -1,22 +1,25 @@ {% extends "seminar/cojemam/base.html" %} -{% block nadpis1 %} +{% block nadpis1a %}{% block nadpis1b %} {% if aktivni %} Organizátoři {% else %} Vysloužilí organizátoři {% endif %} -{% endblock%} +{% endblock%}{% endblock%} + +{% block menu_uvod %}selected{% endblock %} +{% block submenu %} + {% with "org" as selected %} + {% include "seminar/cojemam/submenu.html" %} + {% endwith %} +{% endblock %} {% block content %}
+ {% if not aktivni %} + Aktivní organizátoři + {% endif %} {% for org in object_list %} -

{{org.user.first_name}} {% if org.prezdivka %} @@ -31,13 +34,13 @@

{% endif %}
    - {#TODO časovat dle rodu #} - {% if org.organizuje_od_roku %} -
  • {% if aktivni %}Organizuje{% else %}Organizoval{% endif %} od roku {{org.organizuje_od_roku}} - {% endif %} - {% if org.organizuje_do_roku %} -
  • {% if aktivni %}Organizuje{% else %}Organizoval{% endif %} do roku {{org.organizuje_do_roku}} - {% endif %} +
  • + {% if aktivni %} + Organizuje od roku {{org.organizuje_od_roku}} + {% else %} + {#TODO časovat dle rodu #} + Organizoval v letech {{org.organizuje_od_roku}}–{{org.organizuje_do_roku}} + {% endif %} {% if org.studuje %}
  • Studuje: {{org.studuje}} {% endif %} @@ -53,6 +56,8 @@ {% if aktivni%} Vysloužilí organizátoři + {% else %} + Aktivní organizátoři {% endif %} diff --git a/seminar/templates/seminar/cojemam/submenu.html b/seminar/templates/seminar/cojemam/submenu.html index f130e583..2fe62d2f 100644 --- a/seminar/templates/seminar/cojemam/submenu.html +++ b/seminar/templates/seminar/cojemam/submenu.html @@ -1,10 +1,10 @@ {% with "/co-je-MaM" as cesta %} {% endwith %} diff --git a/seminar/templates/seminar/novinky.html b/seminar/templates/seminar/novinky.html index c3b2e3f6..9fc98570 100644 --- a/seminar/templates/seminar/novinky.html +++ b/seminar/templates/seminar/novinky.html @@ -1,15 +1,32 @@ -{% extends 'base.html' %} -Před začátkem bloku. -{% block body %} -Tady bude začátek. - {% for novinka in novinky %} - {% if novinka.datum > pred_2_mesici and novinka.zverejneno %} -

    - Tady bude novinka. - {{ novinka.text }} -

    - - {% endif %} - {% endfor%} -Tady bude konec. -{% endblock %} +{% for novinka in object_list %} +{# pripravene div-y na stylovani#} +
    + {# datum #} +
    {{novinka.datum}}
    + {# text #} + {{ novinka.text | safe }} + {# obrazek #} + {% if novinka.obrazek %} +
    + +
    + {% endif %} + {# autor #} + {% if user.is_staff %} +
    {{novinka.autor.first_name}} + {% if novinka.autor.organizator.prezdivka%} + „{{novinka.autor.organizator.prezdivka}}“ + {% endif %} + {{novinka.autor.last_name}} +
    + {% endif %} +
    +{% endfor%} + diff --git a/seminar/templates/seminar/pracuje_se.html b/seminar/templates/seminar/pracuje_se.html index f79d3ee3..5349707d 100644 --- a/seminar/templates/seminar/pracuje_se.html +++ b/seminar/templates/seminar/pracuje_se.html @@ -1,7 +1,12 @@ {% load staticfiles %} {% block content %} -

    {% block nadpis1 %}Tady se pracuje{% endblock%}

    +

    + {% block nadpis1a %}{% block nadpis1b %} + Tady se pracuje + {% endblock %}{% endblock %} +

    +

    Na této stránce velmi intenzivně pracujeme. Za dočasnou nedostupnost se omlouváme. diff --git a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html index 42d50db5..a6c07ea0 100644 --- a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html +++ b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html @@ -1,8 +1,19 @@ {% extends "seminar/soustredeni/base.html" %} +{% block menu_soustredeni %}selected{% endblock %} +{% block submenu %} + {% with "probehlo" as selected %} + {% include "seminar/soustredeni/submenu.html" %} + {% endwith %} +{% endblock submenu %} + {% block content %}{% if user.is_authenticated %}{# PRACUJE SE STRANKA #} -

    {% block nadpis1 %}Soustředění{% endblock %}

    +

    + {% block nadpis1a %}{% block nadpis1b %} + Soustředění + {% endblock %}{% endblock %} +

    {# Projdi vsechna soustredeni #} {% for soustredeni in object_list %} diff --git a/seminar/templates/seminar/soustredeni/submenu.html b/seminar/templates/seminar/soustredeni/submenu.html index c1e9deed..d3ef4b18 100644 --- a/seminar/templates/seminar/soustredeni/submenu.html +++ b/seminar/templates/seminar/soustredeni/submenu.html @@ -1,9 +1,9 @@ {% with "/soustredeni" as cesta %} {% endwith %} diff --git a/seminar/templates/seminar/stare_novinky.html b/seminar/templates/seminar/stare_novinky.html new file mode 100644 index 00000000..821889bf --- /dev/null +++ b/seminar/templates/seminar/stare_novinky.html @@ -0,0 +1,13 @@ +{% extends 'base.html' %} + +{% block content %} + +

    + {% block nadpis1a %}{% block nadpis1b %} + Archiv novinek + {% endblock %}{% endblock %} +

    + + {% include 'seminar/novinky.html' %} + +{% endblock %} diff --git a/seminar/templates/seminar/stav_databaze.html b/seminar/templates/seminar/stav_databaze.html index 5c04b9a5..a8170290 100644 --- a/seminar/templates/seminar/stav_databaze.html +++ b/seminar/templates/seminar/stav_databaze.html @@ -2,7 +2,11 @@ {% block content %}
    -

    {% block nadpis1 %}Stav databáze{% endblock %}

    +

    + {% block nadpis1a %}{% block nadpis1b %} + Stav databáze + {% endblock %}{% endblock %} +

    Řešitelé

    diff --git a/seminar/templates/seminar/titulnistrana.html b/seminar/templates/seminar/titulnistrana.html index 424efdee..584668db 100644 --- a/seminar/templates/seminar/titulnistrana.html +++ b/seminar/templates/seminar/titulnistrana.html @@ -1,8 +1,20 @@ -Trala! {% extends 'base.html' %} -HU! -{% block novinky %} - Tady bude nadpis pro novinky. - {% include 'novinky.html' %} + +{% block content %} + + {# Uvitaci text #} +

    + {% block nadpis1a %}{% block nadpis1b %} + Tož vitajte! + {% endblock %}{% endblock %} +

    +

    Uvítací text či-co.

    + + {# Novinky #} +

    Novinky

    + {% include 'seminar/novinky.html' %} + + Archiv novinek + {% endblock %} diff --git a/seminar/templates/seminar/zadani/AktualniZadani.html b/seminar/templates/seminar/zadani/AktualniZadani.html index ae2dfd60..2bda6387 100644 --- a/seminar/templates/seminar/zadani/AktualniZadani.html +++ b/seminar/templates/seminar/zadani/AktualniZadani.html @@ -1,8 +1,19 @@ {% extends "seminar/zadani/base.html" %} +{% block submenu %} + {% with "aktualni" as selected %} + {% include 'seminar/zadani/submenu.html' %} + {% endwith %} +{% endblock submenu %} + {% block content %}
    -

    {% block nadpis1 %}Aktuální zadání{% endblock %}

    +

    + {% block nadpis1a %}{% block nadpis1b %} + Aktuální zadání + {% endblock %}{% endblock %} +

    + {% with nastaveni.aktualni_cislo as ac %} {% if ac.zadane_problemy.all %} @@ -18,9 +29,7 @@ {# publikace jednotlivych zadani #} {% for problem in sada %} {# TODO použít {{problem.kod_v_rocniku}} ? vrací 4.u1 místo 4.1 #} -

    {{problem.cislo_zadani.cislo}}.{{problem.kod}} {{problem.nazev}} - {# nezobrazuj body, pokud nejsou zadane #} - {% if problem.body %}({{problem.body}}b){% endif %}

    +

    {{problem.cislo_zadani.cislo}}.{{problem.kod}} {{problem.nazev}} {{ problem.body_v_zavorce }}

    {% autoescape off %}{{problem.text_zadani}}{% endautoescape %}
    {% endfor %} @@ -28,12 +37,7 @@ Aktuálně nejsou zadané žádné úlohy k řešení. {% endfor %} -

    Témata

    - {% for tema in temata %} -

    Téma {{tema.kod}}: {{tema.nazev}}

    - Stránka tématu - {% autoescape off %}{{tema.text_zadani}}{% endautoescape %} - {% endfor %} +

    Témata

    {% endwith %} diff --git a/seminar/templates/seminar/zadani/Temata.html b/seminar/templates/seminar/zadani/Temata.html index 14a59d5e..87aa8e33 100644 --- a/seminar/templates/seminar/zadani/Temata.html +++ b/seminar/templates/seminar/zadani/Temata.html @@ -1,26 +1,38 @@ {% extends "seminar/zadani/base.html" %} +{% block submenu %} + {% with "temata" as selected %} + {% include 'seminar/zadani/submenu.html' %} + {% endwith %} +{% endblock submenu %} + + {% block content %} {% with nastaveni.aktualni_rocnik as ar %}
    -

    {% block nadpis1 %}Témata{% endblock %}

    +

    + {% block nadpis1a %}{% block nadpis1b %} + Témata + {% endblock %}{% endblock %} +

    + +

    + Témata jsou hlavním obsahem časopisu M&M. Obvykle představují + složitější a obecnější problémy než samostatné úlohy. Navíc je v jejich + zadání vždy prostor pro tvůrčí rozšíření. Za pěkný článek k tématu lze + získat třeba i 20 bodů, určitě se tedy vyplatí se tématy zabývat. +

    - Témata obvykle představují složitější problémy, než samostatné úlohy. Navíc - v jejich zadání je vždy prostor pro tvůrčí rozšíření. Nad nápady - k tématům můžeš přemýšlet celý rok až do termínu odeslání šestého - čísla. Pokud tě něco napadne, napiš nám o tom článek. My došlé články - revidujeme, hodnotíme a ty nejzajímavější uveřejňujeme zde na webu, - případně i v někerém z čísel časopisu. Můžeš také reagovat na - články ostatních řešitelů. Za pěkný článek k tématu lze získat třeba i - 20 bodů, určitě se tedy vyplatí jimi zabývat. Pokud nevíš, jak takový - článek napsat, podívej se na náš návod.{# TODO odkaz #} + Jak řešit téma?

    + {% if temata %}

    Letos jsme pro tebe připravili tato témata:

    + {% endif %} {% for problem in temata %} {# TODO použít {{problem.kod_v_rocniku}} ? vrací t4 místo 4 #} -

    Téma {{problem.kod}}: {{problem.nazev}}

    +

    Téma {{problem.kod}}: {{problem.nazev}}

    {% autoescape off %}{{problem.text_zadani}}{% endautoescape %}
    {% empty %} diff --git a/seminar/templates/seminar/zadani/base.html b/seminar/templates/seminar/zadani/base.html index ba4148aa..043fe401 100644 --- a/seminar/templates/seminar/zadani/base.html +++ b/seminar/templates/seminar/zadani/base.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% block menu_zadani %}selected{% endblock %} + {% block submenu %} {% include 'seminar/zadani/submenu.html' %} {% endblock submenu %} diff --git a/seminar/templates/seminar/zadani/submenu.html b/seminar/templates/seminar/zadani/submenu.html index 92c10be5..1ff532ab 100644 --- a/seminar/templates/seminar/zadani/submenu.html +++ b/seminar/templates/seminar/zadani/submenu.html @@ -1,11 +1,11 @@ {% with "/zadani" as cesta %} {% endwith %} diff --git a/seminar/urls.py b/seminar/urls.py index a64127d6..ff322241 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -7,18 +7,20 @@ urlpatterns = patterns('', url(r'^co-je-MaM/organizatori/organizovali/$', views.CojemamOrganizatoriStariView.as_view(), name='stari_organizatori'), url(r'^archiv/cisla/$', views.CislaView.as_view()), + url(r'^archiv/temata/$', views.ArchivTemataView.as_view()), url(r'^rocnik/(?P\d+)/$', views.RocnikView.as_view(), name='seminar_rocnik'), url(r'^cislo/(?P\d+)\.(?P[0-9-]+)/$', views.CisloView.as_view(), name='seminar_cislo'), url(r'^problem/(?P\d+)/$', views.ProblemView.as_view(), name='seminar_problem'), - url(r'^soustredeni/$', views.SoustredeniListView.as_view(), + url(r'^soustredeni/probehlo/$', views.SoustredeniListView.as_view(), name = 'seminar_seznam_soustredeni'), url(r'^soustredeni/(?P\d+)/$', views.SoustredeniView.as_view(), name='seminar_soustredeni'), url(r'^zadani/aktualni/$', views.AktualniZadaniView, name='seminar_aktualni_zadani'), - url(r'^zadani/temata/$', views.TemataView, name='seminar_temata'), + url(r'^zadani/temata/$', views.ZadaniTemataView, name='seminar_temata'), url(r'^$', views.TitulniStranaView.as_view(), name='titulni_strana'), + url(r'^stare-novinky/$', views.StareNovinkyView.as_view(), name='stare_novinky'), url(r'^stav$', views.StavDatabazeView, name='stav_databaze'), diff --git a/seminar/views.py b/seminar/views.py index cb8d4f20..4eaf8f19 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -11,15 +11,16 @@ from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Orga from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva from . import utils -import datetime +from datetime import timedelta, date +from itertools import groupby def AktualniZadaniView(request): nastaveni = get_object_or_404(Nastaveni) problemy = Problem.objects.filter(cislo_zadani=nastaveni.aktualni_cislo).filter(stav = 'zadany') - ulohy = problemy.filter(typ = 'uloha') - serialy = problemy.filter(typ = 'serial') - temata = problemy.filter(typ = 'tema') + ulohy = problemy.filter(typ = 'uloha').order_by('kod') + serialy = problemy.filter(typ = 'serial').order_by('kod') + temata = problemy.filter(typ = 'tema').order_by('kod') jednorazove_problemy = [ulohy, serialy] return render(request, 'seminar/zadani/AktualniZadani.html', {'nastaveni': nastaveni, @@ -28,11 +29,11 @@ def AktualniZadaniView(request): }, ) -def TemataView(request): +def ZadaniTemataView(request): nastaveni = get_object_or_404(Nastaveni) return render(request, 'seminar/zadani/Temata.html', { - 'temata': Problem.objects.filter(typ=Problem.TYP_TEMA, cislo_zadani__rocnik=nastaveni.aktualni_rocnik), + 'temata': Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY, cislo_zadani__rocnik=nastaveni.aktualni_rocnik).order_by('kod'), } ) @@ -40,19 +41,17 @@ def TemataView(request): class TitulniStranaView(generic.ListView): model = Novinky - template_name='seminar/novinky.html' + template_name='seminar/titulnistrana.html' + queryset = Novinky.objects.filter(zverejneno=True).order_by('-datum')[:5] - def get_context_data(self, **kwargs): - context = super(TitulniStranaView, self).get_context_data(**kwargs) - context['pred_2_mesici'] = (datetime.date.today() - datetime.timedelta(2*365/12)).isoformat() - #ulozi datum pred dvema mesici - #elegantneji mozne pomoci dateutil: - ''' - from dateutil.relativedelta import relativedelta - - date.today() + relativedelta(month=-2) - ''' - return context + #def get_context_data(self, **kwargs): + # context = super(TitulniStranaView, self).get_context_data(**kwargs) + # return context + +class StareNovinkyView(generic.ListView): + model = Novinky + template_name = 'seminar/stare_novinky.html' + queryset = Novinky.objects.filter(zverejneno=True).order_by('-datum') ### Co je M&M @@ -61,7 +60,7 @@ class TitulniStranaView(generic.ListView): class CojemamOrganizatoriView(generic.ListView): model = Organizator template_name='seminar/cojemam/organizatori.html' - queryset = Organizator.objects.filter(user__is_active=True).order_by('user__first_name') + queryset = Organizator.objects.exclude(organizuje_do_roku__isnull=False, organizuje_do_roku__lt=date.today().year).order_by('user__first_name') def get_context_data(self, **kwargs): context = super(CojemamOrganizatoriView, self).get_context_data(**kwargs) context['aktivni'] = True @@ -70,7 +69,7 @@ class CojemamOrganizatoriView(generic.ListView): class CojemamOrganizatoriStariView(generic.ListView): model = Organizator template_name='seminar/cojemam/organizatori.html' - queryset = Organizator.objects.filter(user__is_active=False) + queryset = Organizator.objects.filter(organizuje_do_roku__isnull=False, organizuje_do_roku__lt=date.today().year).order_by('-organizuje_do_roku') ### Archiv @@ -78,6 +77,26 @@ class CislaView(generic.ListView): model = Rocnik template_name='seminar/archiv/cisla.html' + +def sloupec_s_poradim(vysledky): + # počet řešitelů ve výsledkovce nad aktuálním + lepsich_resitelu = 0 + + poradi_l = [] + # projdeme skupiny řešitelů se stejným počtem bodů + for skupina in (list(x) for _, x in groupby(vysledky, lambda x: x.body)): + + # připravíme si obsahy buněk ve sloupci pořadí pro skupinu + if len(skupina) == 1: + poradi_l += ["{}.".format(lepsich_resitelu + 1)] + # je-li účastníků se stejným počtem bodů víc, pořadí (rozsah X.-Y.) je jen u prvního + else: + poradi_l += ["{}.–{}.".format(lepsich_resitelu + 1, lepsich_resitelu + len(skupina))] + [""] * (len(skupina)-1) + lepsich_resitelu += len(skupina) + + return poradi_l + + class RocnikView(generic.DetailView): model = Rocnik template_name = 'seminar/archiv/rocnik.html' @@ -99,73 +118,45 @@ class RocnikView(generic.DetailView): def get_context_data(self, **kwargs): context = super(RocnikView, self).get_context_data(**kwargs) - cisla_v_rocniku = VysledkyKCisluZaRocnik.objects.filter(cislo__verejna_vysledkovka = True).filter(cislo__rocnik = context['rocnik']).order_by('-cislo') + cisla_v_rocniku = VysledkyKCisluZaRocnik.objects.filter(cislo__verejna_vysledkovka = True).filter(cislo__rocnik = context['rocnik']).order_by('cislo') #vyberu vsechny verejne vysledky z rocniku #pokud žádné nejsou, výsledkovka se nezobrazí if cisla_v_rocniku: - vysledky = cisla_v_rocniku.filter(cislo = cisla_v_rocniku[0].cislo).order_by('-body', 'resitel__prijmeni', 'resitel__jmeno').select_related('resitel') + vysledky = list(cisla_v_rocniku.filter(cislo = cisla_v_rocniku[0].cislo).order_by('-body', 'resitel__prijmeni', 'resitel__jmeno').select_related('resitel')) #vybere vsechny vysledky z posledniho verejneho cisla a setridi sestupne dle bodu - vysledky_resitele = {} - stejne_body = {} - konec_rozmezi = {} vysledkovka = [] - posledni_body = 100000 - predchozi_poradi = None - body_minule = None - - for vi in range(len(vysledky)): - v = vysledky[vi] - rv = RadekVysledkovky() - rv.resitel = v.resitel + + # doplníme některé údaje do řádků výsledkovky pro řešitele ve skupině + for poradi, v in zip(sloupec_s_poradim(vysledky), vysledky): + v.poradi = poradi + v.resitel.rocnik = v.resitel.rocnik(context['rocnik']) + verejne_vysl_odjakziva = VysledkyKCisluOdjakziva.objects.filter(cislo__verejna_vysledkovka = True).filter(cislo__rocnik = context['rocnik']).filter(cislo = cisla_v_rocniku[0].cislo) - rv.body_odjakziva = verejne_vysl_odjakziva.filter(resitel = rv.resitel)[0].body - rv.resitel.titul = rv.resitel.get_titul(rv.body_odjakziva) - rv.resitel.rocnik = rv.resitel.rocnik(context['rocnik']) - rv.body = []*len(context['rocnik'].verejna_cisla()) + + v.body_odjakziva = verejne_vysl_odjakziva.filter(resitel = v.resitel)[0].body + v.titul = v.resitel.get_titul(v.body_odjakziva) + v.body_rocnik = v.body + v.body_cisla = [] + #pokud pro dany rok a cislo nema resitel vysledky, ma defaultne 0 for cis in context['rocnik'].verejna_cisla(): if cis.verejna_vysledkovka: - print cis - body_za_cislo = VysledkyZaCislo.objects.filter(cislo__rocnik = context['rocnik']).filter(cislo = cis).filter(resitel = rv.resitel) + body_za_cislo = VysledkyZaCislo.objects.filter(cislo__rocnik = context['rocnik']).filter(cislo = cis).filter(resitel = v.resitel) #seznam vysledku se spravnym rocnikem a cislem pro resitele #zobrazim jen je-li vysledkovka verejna if body_za_cislo: - rv.body.append(body_za_cislo[0].body) + v.body_cisla.append(body_za_cislo[0].body) #neprazdne vysledky by mely obsahovat prave jeden vysledek else: - rv.body.append(0) + v.body_cisla.append(0) #resitel nema za cislo body - rv.poradi = '' - #defaultni poradi je prazdne - kvuli sdilenym mistum - rv.body_rocnik = v.body - rv.body_na_zacatku = rv.body_odjakziva - rv.body_rocnik - #body za minule rocniky - if posledni_body > v.body: - if stejne_body.get(posledni_body): - #pokud uz jsme predtim narazili na stejny pocet bodu - konec_rozmezi[posledni_body] = int(predchozi_poradi.poradi) + stejne_body[posledni_body] - #druha hranice sdilenych pozic - zacatek + pocet lidi se stejnymi body - predchozi_poradi.poradi = '{0}. -- {1}.'.format(predchozi_poradi.poradi,konec_rozmezi[posledni_body]) - #predchozi radek ktery menil pocty bodu bude mit rozsah, pokud bylo vice radku se stejnym poctem bodu - elif predchozi_poradi : - predchozi_poradi.poradi = '{0}.'.format(predchozi_poradi.poradi) - #pokud nebyl rozsah hodnot, vypisu, pridam tecku za cislo - posledni_body = v.body - rv.poradi = vi + 1 - #poradi se meni jen u resitele s rozdilnym poctem bodu nez mel minuly - predchozi_poradi = rv - elif posledni_body == v.body: - if not stejne_body.get(v.body): - stejne_body[v.body] = 1 - #pokud klic neexistuje, zalozim novy pro tohoto resitele - else: - stejne_body[v.body] += 1 - #rozsirim pocet resitelu sdilejici stejnou pozici - vysledky_resitele[v.resitel.id] = rv - #odkaz na radek vysledkovky patrici danemu resiteli - vysledkovka.append(rv) + + vysledkovka.append(v) + + temata_v_rocniku = Problem.objects.filter(typ=Problem.TYP_TEMA, cislo_zadani__rocnik=context['rocnik']) context['vysledkovka'] = vysledkovka + context['temata_v_rocniku'] = temata_v_rocniku return context class ProblemView(generic.DetailView): @@ -194,6 +185,7 @@ class CisloView(generic.DetailView): {'verbose_name': queryset.model._meta.verbose_name}) return obj + def get_context_data(self, **kwargs): context = super(CisloView, self).get_context_data(**kwargs) @@ -206,7 +198,7 @@ class CisloView(generic.DetailView): resene_problemy = Problem.objects.filter(cislo_reseni=context['cislo']).filter(typ__in=typy_skutecne_zadanych).order_by('cislo_reseni__cislo', 'kod') - problemy = sorted(list(set([r.problem for r in reseni])), key=lambda x:(0 if x.typ==Problem.TYP_ULOHA else 1,x.kod)) + problemy = sorted(list(set([r.problem for r in reseni])), key=lambda x:(0 if x.typ==Problem.TYP_ULOHA else 1, x.kod_v_rocniku)) #setridi problemy podle typu a poradi zadani problem_index = {} for i in range(len(problemy)): @@ -214,66 +206,42 @@ class CisloView(generic.DetailView): #umoznuje zjistit index podle id problemu vysledky_resitele = {} - stejne_body = {} - konec_rozmezi = {} vysledkovka = [] - posledni_body = 100000 - predchozi_poradi = None - body_minule = None - - for vi in range(len(vysledky)): - v = vysledky[vi] - tv = RadekVysledkovky() - tv.resitel = v.resitel - tv.resitel.titul = tv.resitel.get_titul(v.body) - tv.rocnik = tv.resitel.rocnik(context['cislo'].rocnik) - tv.vysledek = v - #odkazuje na VysledkyKCislu - tv.body = ['']*len(problemy) - #pole bodu za ulohy - tv.poradi = '' - #defaultni poradi je prazdne - kvuli sdilenym mistum - tv.body_celkem_rocnik = v.body - tv.body_celkem_odjakziva = VysledkyKCisluOdjakziva.objects.get(resitel=v.resitel, cislo=context['cislo']).body + + # doplníme některé údaje do řádků výsledkovky pro řešitele ve skupině + for poradi, v in zip(sloupec_s_poradim(vysledky), vysledky): + v.poradi = poradi + v.body_celkem_rocnik = v.body + v.body_celkem_odjakziva = VysledkyKCisluOdjakziva.objects.get(resitel=v.resitel, cislo=context['cislo']).body + + # je tady '', aby se nezobrazovala 0, pokud se řešitel o řešení úlohy ani nepokusil + v.body_ulohy = [''] * len(problemy) + + v.titul = v.resitel.get_titul(v.body_celkem_odjakziva) + body_cislo_q = VysledkyZaCislo.objects.filter(resitel=v.resitel, cislo=context['cislo']) - tv.body_cislo = body_cislo_q[0].body if len(body_cislo_q) > 0 else 0 - tv.body_minule = tv.body_celkem_rocnik - tv.body_cislo - tv.titul=tv.resitel.get_titul(int(tv.body_celkem_odjakziva)) - #pocet bodu do tohoto cisla - if posledni_body > tv.body_celkem_rocnik: - if stejne_body.get(posledni_body): - konec_rozmezi[posledni_body] = int(predchozi_poradi.poradi) + stejne_body[posledni_body] - #druha hranice sdilenych pozic - zacatek + pocet lidi se stejnymi body - predchozi_poradi.poradi = '{0}. -- {1}.'.format(predchozi_poradi.poradi,konec_rozmezi[posledni_body]) - #predchozi radek ktery menil pocty bodu bude mit rozsah, pokud bylo vice radku se stejnym poctem bodu - elif predchozi_poradi : - predchozi_poradi.poradi = '{0}.'.format(predchozi_poradi.poradi) - #pokud nebyl rozsah hodnot, pridam tecku za cislo - posledni_body = tv.body_celkem_rocnik - tv.poradi = vi + 1 - #poradi se meni jen u resitele s rozdilnym poctem bodu nez mel minuly - predchozi_poradi = tv - elif posledni_body == tv.body_celkem_rocnik: - if not stejne_body.get(tv.body_celkem_rocnik): - stejne_body[tv.body_celkem_rocnik] = 1 - #pokud klic neexistuje, zalozim novy pro tohoto resitele - else: - stejne_body[tv.body_celkem_rocnik] += 1 - #rozsirim pocet resitelu sdilejici stejnou pozici - vysledky_resitele[v.resitel.id] = tv - #odkaz na radek vysledkovky patrici danemu resiteli - vysledkovka.append(tv) + v.body_cislo = body_cislo_q[0].body if body_cislo_q else 0 - for r in reseni: - vysledky_resitele[r.resitel.id].body[problem_index[r.problem.id]] = r.body - + vysledkovka.append(v) + + # připravíme si odkaz na řádek, abychom do něj mohli doplnit body za jednotlivé úlohy + vysledky_resitele[v.resitel.id] = v + # za každé řešení doplníme k příslušnému řešiteli a úloze body + for r in reseni: + vysledky_resitele[r.resitel.id].body_ulohy[problem_index[r.problem.id]] = r.body + context['vysledkovka'] = vysledkovka context['problemy'] = problemy context['v_cisle_zadane'] = v_cisle_zadane context['resene_problemy'] = resene_problemy return context +class ArchivTemataView(generic.ListView): + model = Problem + template_name = 'seminar/archiv/temata.html' + queryset = Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') + ### Generovani vysledkovky class CisloVysledkovkaView(CisloView):