Struktura pro články
This commit is contained in:
parent
d2719e0e0b
commit
1ae9bb5e04
8 changed files with 131 additions and 28 deletions
|
@ -4,31 +4,10 @@
|
|||
|
||||
{% block content %}
|
||||
<div>
|
||||
{% if problem.cislo_zadani %}
|
||||
<h2>
|
||||
{% block nadpis1a %}{% block nadpis1b %}
|
||||
{{ problem.nazev_typu }} {{ problem.kod_v_rocniku }}: {{ problem.nazev }} {{ problem.body_v_zavorce }}
|
||||
{% endblock %}{% endblock %}
|
||||
</h2>
|
||||
{% block problem %}
|
||||
{% endblock %}
|
||||
|
||||
<p>Zadáno v čísle <a href='{{ problem.cislo_zadani.verejne_url }}'>{{ problem.cislo_zadani.kod }}</a>.
|
||||
{% if problem.cislo_reseni %}
|
||||
<p>Řešeno v čísle <a href='{{ problem.cislo_reseni.verejne_url }}'>{{ problem.cislo_reseni.kod }}</a>.
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<h2>Problém {{ problem.nazev }}</h2>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<h3>Zadání</h3>
|
||||
{{ problem.text_zadani |safe }}
|
||||
{% if problem.text_reseni %}
|
||||
<h3>Řešení</h3>
|
||||
{{ problem.text_reseni |safe }}
|
||||
{% endif %}
|
||||
|
||||
{# TODO Kontrola, zda je uzivatel org #}
|
||||
{% if user.is_authenticated %}
|
||||
{% if user.is_staff %}
|
||||
<div class='mam-org-only'>
|
||||
|
||||
<h3>Text - org</h3>
|
||||
|
@ -43,4 +22,3 @@
|
|||
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
|
|
38
seminar/templates/seminar/archiv/problem_clanek.html
Normal file
38
seminar/templates/seminar/archiv/problem_clanek.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
{% extends "seminar/archiv/problem.html" %}
|
||||
|
||||
{% block problem %}
|
||||
{% if problem.cislo_zadani %}
|
||||
|
||||
<h2>
|
||||
{{ problem.nazev_typu }}:
|
||||
{% block nadpis1a %}{% block nadpis1b %}
|
||||
{{ problem.nazev }}
|
||||
{% endblock %}{% endblock %}
|
||||
</h2>
|
||||
|
||||
<div class='problem-autori'>
|
||||
{% if problem.typ == 'res-clanek' %}
|
||||
{# pozor na mezery #}
|
||||
{% for r in reseni %}{% if not forloop.first %}, {% endif %}
|
||||
{{ r.resitel.jmeno }} {{ r.resitel.prijmeni }}{% if r.body %} ({{ r.body }} b){% endif %}{% endfor %}
|
||||
{% else %}
|
||||
{{ problem.autor.first_name }}
|
||||
{% if problem.autor.organizator.prezdivka %}
|
||||
„{{ problem.autor.organizator.prezdivka }}“
|
||||
{% endif %}
|
||||
{{ problem.autor.last_name }}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if problem.cislo_reseni %}
|
||||
<p>Vyšlo v čísle <a href='{{ problem.cislo_reseni.verejne_url }}'>{{ problem.cislo_reseni.kod }}</a>.
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
{# TODO ? #}
|
||||
<h2>Problém {{ problem.nazev }}</h2>
|
||||
{% endif %}
|
||||
|
||||
{{ problem.text_zadani |safe }}
|
||||
|
||||
{% endblock %}
|
27
seminar/templates/seminar/archiv/problem_uloha_tema.html
Normal file
27
seminar/templates/seminar/archiv/problem_uloha_tema.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{% extends "seminar/archiv/problem.html" %}
|
||||
|
||||
{% block problem %}
|
||||
<h2>
|
||||
{% block nadpis1a %}{% block nadpis1b %}
|
||||
{{ problem.nazev_typu }} {{ problem.kod_v_rocniku }}: {{ problem.nazev }} {{ problem.body_v_zavorce }}
|
||||
{% endblock %}{% endblock %}
|
||||
</h2>
|
||||
{% if problem.cislo_zadani %}
|
||||
<p>Zadáno v čísle <a href='{{ problem.cislo_zadani.verejne_url }}'>{{ problem.cislo_zadani.kod }}</a>.
|
||||
{% if problem.cislo_reseni %}
|
||||
<p>Řešeno v čísle <a href='{{ problem.cislo_reseni.verejne_url }}'>{{ problem.cislo_reseni.kod }}</a>.
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{# TODO ? #}
|
||||
<h2>Problém {{ problem.nazev }}</h2>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<h3>Zadání</h3>
|
||||
{{ problem.text_zadani |safe }}
|
||||
{% if problem.text_reseni %}
|
||||
<h3>Řešení</h3>
|
||||
{{ problem.text_reseni |safe }}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,5 @@
|
|||
{% extends 'seminar/clanky/resitelske_clanky.html' %}
|
||||
|
||||
{% block nadpis1a %}{% block nadpis1b %}
|
||||
Organizátorské články
|
||||
{% endblock %}{% endblock %}
|
24
seminar/templates/seminar/clanky/resitelske_clanky.html
Normal file
24
seminar/templates/seminar/clanky/resitelske_clanky.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>
|
||||
{% block nadpis1a %}{% block nadpis1b %}
|
||||
Řešitelské články
|
||||
{% endblock %}{% endblock %}
|
||||
</h2>
|
||||
|
||||
{% for clanek in object_list %}
|
||||
{% with clanek.cislo_zadani.rocnik.rocnik as rocnik %}
|
||||
{% ifchanged rocnik %}
|
||||
{% if not forloop.first %}</ul>{% endif %}
|
||||
<h3>{{ rocnik }}. ročník</h3>
|
||||
<ul>
|
||||
{% endifchanged %}
|
||||
<li>
|
||||
<a href="{{ clanek.verejne_url }}">{{ clanek.nazev }}</a>
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
<ul>
|
||||
<li class="{% if selected == "uvod" %}selected{% endif %}"><a href="{{cesta}}/uvod/">Úvod</a>
|
||||
{# TODO až budou <li class="{% if selected == "org" %}selected{% endif %}"><a href="{{cesta}}/org/">Organizátorské články</a> #}
|
||||
{# TODO až budou <li class="{% if selected == "resitel" %}selected{% endif %}"><a href="{{cesta}}/resitel/">Řešitelské články</a> #}
|
||||
<li class="{% if selected == "org" %}selected{% endif %}"><a href="{{cesta}}/org/">Organizátorské články</a>
|
||||
<li class="{% if selected == "resitel" %}selected{% endif %}"><a href="{{cesta}}/resitel/">Řešitelské články</a>
|
||||
<li class="{% if selected == "jak-psat-vedecky-clanek" %}selected{% endif %}"><a href="{{cesta}}/jak-psat-vedecky-clanek/">Jak napsat článek</a>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -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<prvni_rok>\d+)\.csv$', export.ExportRocnikView.as_view(), name='seminar_export_rocnik'),
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue