From 2f956ae2e7ea0f3d77f584cd41605b59846a2e45 Mon Sep 17 00:00:00 2001 From: Jethro Date: Sun, 13 Sep 2015 14:00:55 +0200 Subject: [PATCH 1/3] Zobrazovat probehla soustredeni. --- .../soustredeni/seznam_soustredeni.html | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html index 020c78b6..45d2ba75 100644 --- a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html +++ b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html @@ -9,13 +9,13 @@ {# zmena fotky #}{% block header %}soustredeni{% endblock %} -{% block content %}{% if user.is_authenticated %}{# PRACUJE SE STRANKA #} +{% block nadpis1a %}{% block nadpis1b %} + Soustředění +{% endblock %}{% endblock %} + +{% block content %} +{#% if user.is_authenticated %#}{# PRACUJE SE STRANKA #} -

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

{# Projdi vsechna soustredeni #} {% for soustredeni in object_list %} @@ -29,30 +29,36 @@ že jste přihlášení.
{% endif %} {# misto soustredeni TODO upravit#} - {% if soustredeni.misto %}

- Soustředění v {{soustredeni.misto}} - od {{soustredeni.datum_zacatku}} do {{soustredeni.datum_konce}} - při {{soustredeni.rocnik.rocnik}}. ročníku M&M + {{soustredeni.get_typ_display}} + {{soustredeni.misto}}

- {% endif %} + {# popis soustredeni #} {% if soustredeni.text %} {% autoescape off %}{{soustredeni.text}}{% endautoescape %} {% endif %} - {# Účastníci #} -

Soustředění se zúčastnili tito účastníci:

- + {% if user.is_authenticated %} + {# Účastníci #} +

Soustředění se zúčastnili tito účastníci:

+ + {% endif %} {% endif %} {% empty %} Žádná soustředění zatím neproběhla! {% endfor %} -{% else %}{% include 'seminar/pracuje_se.html' %}{% endif %}{% endblock %} +{#% else %}{% include 'seminar/pracuje_se.html' %}{% endif %#} + +{% endblock %} From af89687996e7904e52f50cb8eaa54c73b6f1b74e Mon Sep 17 00:00:00 2001 From: Jethro Date: Sun, 13 Sep 2015 14:03:01 +0200 Subject: [PATCH 2/3] Nezobrazovat text k sous. --- .../templates/seminar/soustredeni/seznam_soustredeni.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html index 45d2ba75..a6672c95 100644 --- a/seminar/templates/seminar/soustredeni/seznam_soustredeni.html +++ b/seminar/templates/seminar/soustredeni/seznam_soustredeni.html @@ -38,11 +38,11 @@ {{soustredeni.datum_zacatku}} – {{soustredeni.datum_konce}} - {# popis soustredeni #} - {% if soustredeni.text %} - {% autoescape off %}{{soustredeni.text}}{% endautoescape %} - {% endif %} {% if user.is_authenticated %} + {# popis soustredeni #} + {% if soustredeni.text %} + {% autoescape off %}{{soustredeni.text}}{% endautoescape %} + {% endif %} {# Účastníci #}

Soustředění se zúčastnili tito účastníci:

{% endif %} +

{{ rocnik }}. ročník

+ + +{% endblock %} diff --git a/seminar/templates/seminar/clanky/submenu.html b/seminar/templates/seminar/clanky/submenu.html index 0a19761b..2c70a5da 100644 --- a/seminar/templates/seminar/clanky/submenu.html +++ b/seminar/templates/seminar/clanky/submenu.html @@ -2,8 +2,8 @@ diff --git a/seminar/urls.py b/seminar/urls.py index ff322241..1af3d42a 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -22,6 +22,10 @@ urlpatterns = patterns('', url(r'^$', views.TitulniStranaView.as_view(), name='titulni_strana'), url(r'^stare-novinky/$', views.StareNovinkyView.as_view(), name='stare_novinky'), + url(r'^clanky/resitel/$', views.ClankyResitelView.as_view(), name='clanky_resitel'), + url(r'^clanky/org/$', views.ClankyOrganizatorView.as_view(), name='clanky_organizator'), + + url(r'^stav$', views.StavDatabazeView, name='stav_databaze'), url(r'^aesop-export/mam-rocnik-(?P\d+)\.csv$', export.ExportRocnikView.as_view(), name='seminar_export_rocnik'), diff --git a/seminar/views.py b/seminar/views.py index e2549fd7..e74955a8 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -159,9 +159,23 @@ class RocnikView(generic.DetailView): context['temata_v_rocniku'] = temata_v_rocniku return context + class ProblemView(generic.DetailView): model = Problem - template_name = 'seminar/archiv/problem.html' + + def _je_clanek(self, problem): + return problem.typ in [Problem.TYP_ORG_CLANEK, Problem.TYP_RES_CLANEK] + + def get_template_names(self, **kwargs): + context = super(ProblemView, self).get_context_data(**kwargs) + return ['seminar/archiv/problem_' + ('clanek.html' if self._je_clanek(context['problem']) else 'uloha_tema.html')] + + def get_context_data(self, **kwargs): + context = super(ProblemView, self).get_context_data(**kwargs) + if context['problem'].typ == Problem.TYP_RES_CLANEK: + context['reseni'] = Reseni.objects.filter(problem=context['problem']).select_related('resitel').order_by('resitel__prijmeni') + return context + class RadekVysledkovky(object): pass @@ -271,6 +285,19 @@ class SoustredeniView(generic.DetailView): model = Soustredeni template_name = 'seminar/archiv/soustredeni.html' +### Články + +class ClankyResitelView(generic.ListView): + model = Problem + template_name = 'seminar/clanky/resitelske_clanky.html' + queryset = Problem.objects.filter(typ=Problem.TYP_RES_CLANEK, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') + +class ClankyOrganizatorView(generic.ListView): + model = Problem + template_name = 'seminar/clanky/organizatorske_clanky.html' + queryset = Problem.objects.filter(typ=Problem.TYP_ORG_CLANEK, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') + + ### Status def StavDatabazeView(request):