Browse Source

Seznam organizátorů do personálního

pull/60/head
Jonas Havelka 4 months ago
parent
commit
a6eebb2d59
  1. 0
      personalni/templates/personalni/organizatori.html
  2. 12
      personalni/urls.py
  3. 29
      personalni/views.py
  4. 4
      seminar/urls.py
  5. 31
      seminar/views/views_all.py

0
seminar/templates/seminar/cojemam/organizatori.html → personalni/templates/personalni/organizatori.html

12
personalni/urls.py

@ -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'
),
]

29
personalni/views.py

@ -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."""

4
seminar/urls.py

@ -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"),

31
seminar/views/views_all.py

@ -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…
Cancel
Save