Rozstřílení seminářové aplikace #60
5 changed files with 42 additions and 34 deletions
|
@ -21,4 +21,16 @@ urlpatterns = [
|
||||||
# Obecný view na profil -- orgům dá rozcestník, řešitelům jejich stránku
|
# Obecný view na profil -- orgům dá rozcestník, řešitelům jejich stránku
|
||||||
path('profil/', views.profilView, name='profil'),
|
path('profil/', views.profilView, name='profil'),
|
||||||
|
|
||||||
|
# Seznam organizátorů
|
||||||
|
path(
|
||||||
|
'o-nas/organizatori/',
|
||||||
|
views.CojemamOrganizatoriView.as_view(),
|
||||||
|
name='organizatori'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'o-nas/organizatori/organizovali/',
|
||||||
|
views.CojemamOrganizatoriStariView.as_view(),
|
||||||
|
name='stari_organizatori'
|
||||||
|
),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -8,6 +8,7 @@ from django.contrib.auth.models import User, Permission, Group, AnonymousUser
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
import seminar.models as s
|
import seminar.models as s
|
||||||
import seminar.models as m
|
import seminar.models as m
|
||||||
|
@ -23,6 +24,34 @@ from various.autentizace.utils import posli_reset_hesla
|
||||||
|
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
|
|
||||||
|
from .models import Organizator
|
||||||
|
|
||||||
|
|
||||||
|
def aktivniOrganizatori(datum=timezone.now()):
|
||||||
|
return Organizator.objects.exclude(
|
||||||
|
organizuje_do__isnull=False,
|
||||||
|
organizuje_do__lt=datum
|
||||||
|
).order_by('osoba__jmeno')
|
||||||
|
|
||||||
|
|
||||||
|
class CojemamOrganizatoriView(generic.ListView):
|
||||||
|
model = Organizator
|
||||||
|
template_name = 'personalni/organizatori.html'
|
||||||
|
queryset = aktivniOrganizatori()
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(CojemamOrganizatoriView, self).get_context_data(**kwargs)
|
||||||
|
context['aktivni'] = True
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
class CojemamOrganizatoriStariView(generic.ListView):
|
||||||
|
model = Organizator
|
||||||
|
template_name = 'personalni/organizatori.html'
|
||||||
|
queryset = Organizator.objects.exclude(
|
||||||
|
id__in=aktivniOrganizatori()
|
||||||
|
).order_by('-organizuje_do')
|
||||||
|
|
||||||
|
|
||||||
class OrgoRozcestnikView(TemplateView):
|
class OrgoRozcestnikView(TemplateView):
|
||||||
""" Zobrazí organizátorský rozcestník."""
|
""" Zobrazí organizátorský rozcestník."""
|
||||||
|
|
|
@ -6,10 +6,6 @@ urlpatterns = [
|
||||||
# path('aktualni/temata/', views.TemataRozcestnikView),
|
# path('aktualni/temata/', views.TemataRozcestnikView),
|
||||||
# path('<int:rocnik>/t<int:tematko>/', views.TematkoView),
|
# path('<int:rocnik>/t<int:tematko>/', views.TematkoView),
|
||||||
|
|
||||||
# Organizatori
|
|
||||||
path('o-nas/organizatori/', views.CojemamOrganizatoriView.as_view(), name='organizatori'),
|
|
||||||
path('o-nas/organizatori/organizovali/', views.CojemamOrganizatoriStariView.as_view(), name='stari_organizatori'),
|
|
||||||
|
|
||||||
# Archiv
|
# Archiv
|
||||||
path('archiv/rocniky/', views.ArchivView.as_view(), name="seminar_archiv_rocniky"),
|
path('archiv/rocniky/', views.ArchivView.as_view(), name="seminar_archiv_rocniky"),
|
||||||
path('archiv/temata/', views.ArchivTemataView.as_view(), name="seminar_archiv_temata"),
|
path('archiv/temata/', views.ArchivTemataView.as_view(), name="seminar_archiv_temata"),
|
||||||
|
|
|
@ -13,7 +13,7 @@ from django.contrib.staticfiles.finders import find
|
||||||
import seminar.models as s
|
import seminar.models as s
|
||||||
import seminar.models as m
|
import seminar.models as m
|
||||||
from seminar.models import Problem, Cislo, Reseni, Nastaveni, Rocnik, \
|
from seminar.models import Problem, Cislo, Reseni, Nastaveni, Rocnik, \
|
||||||
Organizator, Resitel, Novinky, Tema, Clanek, \
|
Resitel, Novinky, Tema, Clanek, \
|
||||||
Deadline # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci
|
Deadline # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci
|
||||||
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
||||||
from seminar import utils
|
from seminar import utils
|
||||||
|
@ -24,7 +24,6 @@ from vysledkovky.utils import body_resitelu, VysledkovkaCisla, \
|
||||||
VysledkovkaRocniku, VysledkovkaDoTeXu
|
VysledkovkaRocniku, VysledkovkaDoTeXu
|
||||||
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from django.utils import timezone
|
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -224,34 +223,6 @@ def aktualni_temata(rocnik):
|
||||||
return Tema.objects.filter(rocnik=rocnik, stav='zadany').order_by('kod')
|
return Tema.objects.filter(rocnik=rocnik, stav='zadany').order_by('kod')
|
||||||
|
|
||||||
|
|
||||||
### Co je M&M
|
|
||||||
|
|
||||||
|
|
||||||
# Organizatori
|
|
||||||
def aktivniOrganizatori(datum=timezone.now()):
|
|
||||||
return Organizator.objects.exclude(
|
|
||||||
organizuje_do__isnull=False,
|
|
||||||
organizuje_do__lt=datum
|
|
||||||
).order_by('osoba__jmeno')
|
|
||||||
|
|
||||||
|
|
||||||
class CojemamOrganizatoriView(generic.ListView):
|
|
||||||
model = Organizator
|
|
||||||
template_name = 'seminar/cojemam/organizatori.html'
|
|
||||||
queryset = aktivniOrganizatori()
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
context = super(CojemamOrganizatoriView, self).get_context_data(**kwargs)
|
|
||||||
context['aktivni'] = True
|
|
||||||
return context
|
|
||||||
|
|
||||||
|
|
||||||
class CojemamOrganizatoriStariView(generic.ListView):
|
|
||||||
model = Organizator
|
|
||||||
template_name = 'seminar/cojemam/organizatori.html'
|
|
||||||
queryset = Organizator.objects.exclude(
|
|
||||||
id__in=aktivniOrganizatori()).order_by('-organizuje_do')
|
|
||||||
|
|
||||||
### Archiv
|
### Archiv
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue