|
@ -801,6 +801,7 @@ class RocnikVysledkovkaView(RocnikView): |
|
|
#vypise na stranku textovy obsah vyTeXane vysledkovky k okopirovani |
|
|
#vypise na stranku textovy obsah vyTeXane vysledkovky k okopirovani |
|
|
|
|
|
|
|
|
### Generovani obalek |
|
|
### Generovani obalek |
|
|
|
|
|
|
|
|
class CisloObalkyStruct: |
|
|
class CisloObalkyStruct: |
|
|
rocnik = None |
|
|
rocnik = None |
|
|
cisla = None |
|
|
cisla = None |
|
@ -830,8 +831,10 @@ def aktivniResitele(rocnik,cislo): |
|
|
if int(cislo) > 3: |
|
|
if int(cislo) > 3: |
|
|
problemy = Problem.objects.filter(cislo_zadani__in = letos.cisla) |
|
|
problemy = Problem.objects.filter(cislo_zadani__in = letos.cisla) |
|
|
else: |
|
|
else: |
|
|
problemy = Problem.objects.filter(Q(cislo_zadani__in = letos.cisla)|Q(cislo_zadani__in = loni.cisla)) |
|
|
problemy = Problem.objects.filter( |
|
|
resitele = aktualni_resitele.filter(reseni__in = Reseni.objects.filter(problem__in=problemy)).distinct() |
|
|
Q(cislo_zadani__in = letos.cisla) | Q(cislo_zadani__in = loni.cisla) ) |
|
|
|
|
|
resitele = aktualni_resitele.filter(reseni__in = Reseni.objects.filter( |
|
|
|
|
|
problem__in=problemy)).distinct() |
|
|
return resitele |
|
|
return resitele |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -904,8 +907,6 @@ def TitulyView(request, rocnik, cislo): |
|
|
return render(request, 'seminar/archiv/tituly.tex', |
|
|
return render(request, 'seminar/archiv/tituly.tex', |
|
|
{'resitele': resitele,'jmenovci':jmenovci},content_type="text/plain") |
|
|
{'resitele': resitele,'jmenovci':jmenovci},content_type="text/plain") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Soustredeni |
|
|
### Soustredeni |
|
|
|
|
|
|
|
|
class SoustredeniListView(generic.ListView): |
|
|
class SoustredeniListView(generic.ListView): |
|
@ -1062,11 +1063,11 @@ def texUploadView(request): |
|
|
} |
|
|
} |
|
|
problem_typ = typy[meta["typ"]] |
|
|
problem_typ = typy[meta["typ"]] |
|
|
|
|
|
|
|
|
# Pokud už problém existuje, vytáhneme jej z db a upravíme |
|
|
# Pokud už problém existuje, vytáhneme jej z db a upravíme. |
|
|
# Pokud neexistuje, vytvoříme jej jedině pokud je to vynucené |
|
|
# Pokud neexistuje, vytvoříme jej jedině pokud je to vynucené. |
|
|
|
|
|
|
|
|
# Pokud ročník/číslo ještě neexistuje, vyhodí to výjimku -> |
|
|
# Pokud ročník/číslo ještě neexistuje, vyhodí to výjimku -> |
|
|
# číslo/ročník se musí založit ručně v adminu |
|
|
# číslo/ročník se musí založit ručně v adminu. |
|
|
rocnik = Rocnik.objects.get(rocnik=meta["rocnik"]) |
|
|
rocnik = Rocnik.objects.get(rocnik=meta["rocnik"]) |
|
|
cislo = Cislo.objects.get(rocnik=rocnik, cislo=meta["cislo"]) |
|
|
cislo = Cislo.objects.get(rocnik=rocnik, cislo=meta["cislo"]) |
|
|
|
|
|
|
|
@ -1200,7 +1201,8 @@ class ResitelView(LoginRequiredMixin,generic.DetailView): |
|
|
print(self.request.user) |
|
|
print(self.request.user) |
|
|
return Resitel.objects.get(osoba__user=self.request.user) |
|
|
return Resitel.objects.get(osoba__user=self.request.user) |
|
|
|
|
|
|
|
|
## Formulare |
|
|
### Formulare |
|
|
|
|
|
|
|
|
class AddSolutionView(LoginRequiredMixin, FormView): |
|
|
class AddSolutionView(LoginRequiredMixin, FormView): |
|
|
template_name = 'seminar/org/vloz_reseni.html' |
|
|
template_name = 'seminar/org/vloz_reseni.html' |
|
|
form_class = f.VlozReseniForm |
|
|
form_class = f.VlozReseniForm |
|
@ -1239,9 +1241,6 @@ class SubmitSolutionView(LoginRequiredMixin, CreateView): |
|
|
|
|
|
|
|
|
return HttpResponseRedirect(self.get_success_url()) |
|
|
return HttpResponseRedirect(self.get_success_url()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def resetPasswordView(request): |
|
|
def resetPasswordView(request): |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
@ -1403,10 +1402,6 @@ def prihlaskaView(request): |
|
|
|
|
|
|
|
|
return render(request, 'seminar/prihlaska.html', {'form': form}) |
|
|
return render(request, 'seminar/prihlaska.html', {'form': form}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# FIXME: Tohle asi vlastně vůbec nepatří do aplikace 'seminar' |
|
|
# FIXME: Tohle asi vlastně vůbec nepatří do aplikace 'seminar' |
|
|
class LoginView(auth_views.LoginView): |
|
|
class LoginView(auth_views.LoginView): |
|
|
# Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL |
|
|
# Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL |
|
@ -1424,25 +1419,25 @@ class LogoutView(auth_views.LogoutView): |
|
|
# Pavel: Vůbec nevím, proč to s _lazy funguje, ale bez toho to bylo rozbité. |
|
|
# Pavel: Vůbec nevím, proč to s _lazy funguje, ale bez toho to bylo rozbité. |
|
|
next_page = reverse_lazy('titulni_strana') |
|
|
next_page = reverse_lazy('titulni_strana') |
|
|
|
|
|
|
|
|
# "Chci resetovat heslo" |
|
|
|
|
|
class PasswordResetView(auth_views.PasswordResetView): |
|
|
class PasswordResetView(auth_views.PasswordResetView): |
|
|
|
|
|
""" Chci resetovat heslo. """ |
|
|
#template_name = 'seminar/password_reset.html' |
|
|
#template_name = 'seminar/password_reset.html' |
|
|
# TODO: vlastní email_template_name a subject_template_name a html_email_template_name |
|
|
# TODO: vlastní email_template_name a subject_template_name a html_email_template_name |
|
|
success_url = reverse_lazy('reset_password_done') |
|
|
success_url = reverse_lazy('reset_password_done') |
|
|
from_email = 'login@mam.mff.cuni.cz' |
|
|
from_email = 'login@mam.mff.cuni.cz' |
|
|
|
|
|
|
|
|
# "Poslali jsme e-mail (pokud bylo kam))" |
|
|
|
|
|
class PasswordResetDoneView(auth_views.PasswordResetDoneView): |
|
|
class PasswordResetDoneView(auth_views.PasswordResetDoneView): |
|
|
|
|
|
""" Poslali jsme e-mail (pokud bylo kam)). """ |
|
|
#template_name = 'seminar/password_reset_done.html' |
|
|
#template_name = 'seminar/password_reset_done.html' |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
# "Vymysli si heslo" |
|
|
|
|
|
class PasswordResetConfirmView(auth_views.PasswordResetConfirmView): |
|
|
class PasswordResetConfirmView(auth_views.PasswordResetConfirmView): |
|
|
|
|
|
""" Vymysli si heslo. """ |
|
|
#template_name = 'seminar/password_confirm_done.html' |
|
|
#template_name = 'seminar/password_confirm_done.html' |
|
|
success_url = reverse_lazy('reset_password_complete') |
|
|
success_url = reverse_lazy('reset_password_complete') |
|
|
|
|
|
|
|
|
# "Heslo se asi změnilo." |
|
|
|
|
|
class PasswordResetCompleteView(auth_views.PasswordResetCompleteView): |
|
|
class PasswordResetCompleteView(auth_views.PasswordResetCompleteView): |
|
|
|
|
|
""" Heslo se asi změnilo.""" |
|
|
#template_name = 'seminar/password_complete_done.html' |
|
|
#template_name = 'seminar/password_complete_done.html' |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|