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
|
||||
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.db import transaction
|
||||
from django.http import HttpResponse
|
||||
from django.utils import timezone
|
||||
|
||||
import seminar.models as s
|
||||
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 .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):
|
||||
""" Zobrazí organizátorský rozcestník."""
|
||||
|
|
|
@ -6,10 +6,6 @@ urlpatterns = [
|
|||
# path('aktualni/temata/', views.TemataRozcestnikView),
|
||||
# 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
|
||||
path('archiv/rocniky/', views.ArchivView.as_view(), name="seminar_archiv_rocniky"),
|
||||
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 m
|
||||
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
|
||||
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
|
||||
from seminar import utils
|
||||
|
@ -24,7 +24,6 @@ from vysledkovky.utils import body_resitelu, VysledkovkaCisla, \
|
|||
VysledkovkaRocniku, VysledkovkaDoTeXu
|
||||
|
||||
from datetime import date, datetime
|
||||
from django.utils import timezone
|
||||
from itertools import groupby
|
||||
from collections import OrderedDict
|
||||
import tempfile
|
||||
|
@ -224,34 +223,6 @@ def aktualni_temata(rocnik):
|
|||
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue