|
|
@ -17,7 +17,9 @@ from django.http import HttpResponse |
|
|
|
from django.utils import timezone |
|
|
|
|
|
|
|
import seminar.models as s |
|
|
|
import seminar.models as m |
|
|
|
import personalni.models as m |
|
|
|
from soustredeni.models import Soustredeni |
|
|
|
from odevzdavatko.models import Hodnoceni |
|
|
|
from .forms import PrihlaskaForm, ProfileEditForm, PoMaturiteProfileEditForm |
|
|
|
|
|
|
|
from datetime import date |
|
|
@ -91,7 +93,7 @@ class OrgoRozcestnikView(TemplateView): |
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
context = super().get_context_data(**kwargs) |
|
|
|
context['posledni_soustredeni'] = s.Soustredeni.objects.order_by('-datum_konce').first() |
|
|
|
context['posledni_soustredeni'] = Soustredeni.objects.order_by('-datum_konce').first() |
|
|
|
nastaveni = s.Nastaveni.objects.first() |
|
|
|
aktualni_rocnik = nastaveni.aktualni_rocnik |
|
|
|
context['posledni_cislo_url'] = nastaveni.aktualni_cislo.verejne_url() |
|
|
@ -99,14 +101,14 @@ class OrgoRozcestnikView(TemplateView): |
|
|
|
# pokud nechceme haluzit kód (= poradi) dalšího čísla, bude asi potřeba jít |
|
|
|
# přes treenody (a dát si přitom pozor na MezicisloNode) |
|
|
|
|
|
|
|
neobodovana_reseni = s.Hodnoceni.objects.filter(body__isnull=True) |
|
|
|
reseni_mimo_cislo = s.Hodnoceni.objects.filter(deadline_body__isnull=True) |
|
|
|
neobodovana_reseni = Hodnoceni.objects.filter(body__isnull=True) |
|
|
|
reseni_mimo_cislo = Hodnoceni.objects.filter(deadline_body__isnull=True) |
|
|
|
context['pocet_neobodovanych_reseni'] = neobodovana_reseni.count() |
|
|
|
context['pocet_reseni_mimo_cislo'] = reseni_mimo_cislo.count() |
|
|
|
|
|
|
|
u = self.request.user |
|
|
|
os = s.Osoba.objects.get(user=u) |
|
|
|
organizator = s.Organizator.objects.get(osoba=os) |
|
|
|
os = m.Osoba.objects.get(user=u) |
|
|
|
organizator = m.Organizator.objects.get(osoba=os) |
|
|
|
|
|
|
|
context['muj_pocet_neobodovanych_reseni'] = neobodovana_reseni.filter(Q(problem__garant=organizator) | Q(problem__autor=organizator) | Q(problem__opravovatele__in=[organizator])).distinct().count() |
|
|
|
context['muj_pocet_reseni_mimo_cislo'] = reseni_mimo_cislo.filter(Q(problem__garant=organizator) | Q(problem__autor=organizator) | Q(problem__opravovatele__in=[organizator])).count() |
|
|
@ -134,12 +136,12 @@ class OrgoRozcestnikView(TemplateView): |
|
|
|
|
|
|
|
|
|
|
|
class ResitelView(LoginRequiredMixin,generic.DetailView): |
|
|
|
model = s.Resitel |
|
|
|
model = m.Resitel |
|
|
|
template_name = 'personalni/profil/resitel.html' |
|
|
|
|
|
|
|
def get_object(self, queryset=None): |
|
|
|
print(self.request.user) |
|
|
|
return s.Resitel.objects.get(osoba__user=self.request.user) |
|
|
|
return m.Resitel.objects.get(osoba__user=self.request.user) |
|
|
|
|
|
|
|
### Formulare |
|
|
|
|
|
|
@ -160,7 +162,7 @@ def resitelEditView(request): |
|
|
|
err_logger = logging.getLogger('seminar.prihlaska.problem') |
|
|
|
## Načtení objektů Osoba a Resitel patřících k aktuálně přihlášenému uživateli |
|
|
|
u = request.user |
|
|
|
osoba_edit = s.Osoba.objects.get(user=u) |
|
|
|
osoba_edit = m.Osoba.objects.get(user=u) |
|
|
|
if hasattr(osoba_edit,'resitel'): |
|
|
|
resitel_edit = osoba_edit.resitel |
|
|
|
else: |
|
|
@ -266,7 +268,7 @@ def prihlaskaView(request): |
|
|
|
resitel_grp = Group.objects.filter(name__exact='resitel').first() |
|
|
|
u.groups.add(resitel_grp) |
|
|
|
|
|
|
|
o = s.Osoba( |
|
|
|
o = m.Osoba( |
|
|
|
jmeno = fcd['jmeno'], |
|
|
|
prijmeni = fcd['prijmeni'], |
|
|
|
osloveni = fcd['osloveni'], |
|
|
@ -328,7 +330,7 @@ def prihlaskaView(request): |
|
|
|
if kolize.count() > 1: # Jednu z nich jsme právě uložili |
|
|
|
err_logger.warning(f'Zaregistrovala se osoba s kolizním jménem. ID osob: {[o.id for o in kolize]}') |
|
|
|
|
|
|
|
r = s.Resitel( |
|
|
|
r = m.Resitel( |
|
|
|
prezdivka_resitele=fcd['prezdivka_resitele'] if fcd['prezdivka_resitele'] != "" else None, |
|
|
|
rok_maturity = fcd['rok_maturity'], |
|
|
|
zasilat = fcd['zasilat'], |
|
|
|