@ -1,16 +0,0 @@ |
|||
{% extends 'base.html' %} |
|||
|
|||
{% load humanize %} |
|||
{% load static %} |
|||
|
|||
|
|||
{% block content %} |
|||
|
|||
<div class=jakresit> |
|||
|
|||
{% include 'seminar/jakresit/jakresit_1.svg' %} |
|||
{% include 'seminar/jakresit/jakresit_2.svg' %} |
|||
{% include 'seminar/jakresit/jakresit_3.svg' %} |
|||
|
|||
</div> |
|||
{% endblock %} |
@ -0,0 +1,16 @@ |
|||
{% extends 'base.html' %} |
|||
|
|||
{% load humanize %} |
|||
{% load static %} |
|||
|
|||
|
|||
{% block content %} |
|||
|
|||
<div class=jakresit> |
|||
|
|||
{% include 'various/jakresit/jakresit_1.svg' %} |
|||
{% include 'various/jakresit/jakresit_2.svg' %} |
|||
{% include 'various/jakresit/jakresit_3.svg' %} |
|||
|
|||
</div> |
|||
{% endblock %} |
Before Width: | Height: | Size: 664 KiB After Width: | Height: | Size: 664 KiB |
Before Width: | Height: | Size: 689 KiB After Width: | Height: | Size: 689 KiB |
Before Width: | Height: | Size: 767 KiB After Width: | Height: | Size: 767 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
@ -0,0 +1,9 @@ |
|||
from django.urls import path |
|||
from .views.final import TitulniStranaView, JakResitView, StavDatabazeView |
|||
from seminar.utils import org_required |
|||
|
|||
urlpatterns = [ |
|||
path('', TitulniStranaView.as_view(), name='titulni_strana'), |
|||
path('jak-resit/', JakResitView.as_view(), name='jak_resit'), |
|||
path('stav', org_required(StavDatabazeView), name='stav_databaze'), |
|||
] |
@ -0,0 +1,73 @@ |
|||
""" |
|||
Stránky, které se mi nepovedlo lépe zařadit. |
|||
|
|||
Oproti `./pomocne.py` se tyto views používají přímo ve various |
|||
a naopak importují spoustu věcí odjinud |
|||
""" |
|||
|
|||
from django.shortcuts import get_object_or_404, render |
|||
from django.utils import timezone |
|||
from django.views import generic |
|||
|
|||
import novinky.views |
|||
import seminar.utils |
|||
import seminar.views |
|||
from personalni.models import Resitel |
|||
from seminar import models as m |
|||
|
|||
from ..models import Nastaveni |
|||
|
|||
|
|||
class TitulniStranaView(generic.ListView): |
|||
template_name = 'various/titulnistrana/titulnistrana.html' |
|||
|
|||
def get_queryset(self): |
|||
return novinky.views.spravne_novinky(self.request)[:3] |
|||
|
|||
def get_context_data(self, **kwargs): |
|||
context = super(TitulniStranaView, self).get_context_data(**kwargs) |
|||
nastaveni = get_object_or_404(Nastaveni) |
|||
|
|||
deadline = m.Deadline.objects.filter( |
|||
deadline__gte=timezone.now()).order_by("deadline").first() |
|||
context['nejblizsi_deadline'] = deadline |
|||
|
|||
# Aktuální témata |
|||
nazvy_a_odkazy_na_aktualni_temata = [] |
|||
akt_temata = seminar.views.aktualni_temata(nastaveni.aktualni_rocnik) |
|||
|
|||
for tema in akt_temata: |
|||
# FIXME: netuším, jestli funguje tema.verejne_url(), nemáme testdata na témátka - je to asi url vzhledem k ročníku |
|||
nazvy_a_odkazy_na_aktualni_temata.append({ |
|||
'nazev': tema.nazev, |
|||
'url': tema.verejne_url() |
|||
}) |
|||
|
|||
context['aktualni_temata'] = nazvy_a_odkazy_na_aktualni_temata |
|||
|
|||
return context |
|||
|
|||
|
|||
class JakResitView(generic.ListView): |
|||
template_name = 'various/jakresit/jak-resit.html' |
|||
|
|||
def get_queryset(self): |
|||
return None |
|||
|
|||
|
|||
### Status |
|||
def StavDatabazeView(request): |
|||
# nastaveni = Nastaveni.objects.get() |
|||
problemy = seminar.utils.seznam_problemu() |
|||
muzi = Resitel.objects.filter(osoba__osloveni=m.Osoba.OSLOVENI_MUZSKE) |
|||
zeny = Resitel.objects.filter(osoba__osloveni=m.Osoba.OSLOVENI_ZENSKE) |
|||
return render(request, 'various/stav_databaze.html', { |
|||
# 'nastaveni': nastaveni, |
|||
'problemy': problemy, |
|||
|
|||
'resitele': Resitel.objects.all(), |
|||
'muzi': muzi, |
|||
'zeny': zeny, |
|||
'jmena_muzu': seminar.utils.histogram([r.osoba.jmeno for r in muzi]), |
|||
'jmena_zen': seminar.utils.histogram([r.osoba.jmeno for r in zeny]), |
|||
}) |
@ -0,0 +1,26 @@ |
|||
""" |
|||
Stránky, které se mi nepovedlo lépe zařadit. |
|||
|
|||
Oproti `./final.py` se tyto views importují odjinud |
|||
tedy ideálně neimportovat sem nic od jinud |
|||
""" |
|||
|
|||
from typing import Sequence |
|||
|
|||
from django.shortcuts import render |
|||
from django.urls import reverse |
|||
|
|||
|
|||
# Interní, nemá se nikdy objevit v urls (jinak to účastníci vytrolí) |
|||
def formularOKView(request, text='', dalsi_odkazy: Sequence[tuple[str, str]] = ()): |
|||
template_name = 'seminar/formular_ok.html' |
|||
odkazy = list(dalsi_odkazy) + [ |
|||
# (Text, odkaz) |
|||
('Vrátit se na titulní stránku', reverse('titulni_strana')), |
|||
('Zobrazit aktuální zadání', reverse('seminar_aktualni_zadani')), |
|||
] |
|||
context = { |
|||
'odkazy': odkazy, |
|||
'text': text, |
|||
} |
|||
return render(request, template_name, context) |