From 5d7237b83fdd68bdd2ee8b7658fdd59dda5d44f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 29 Jun 2022 17:10:32 +0200 Subject: [PATCH 1/6] =?UTF-8?q?e-mailov=C3=A1=20konference=20->=20discord?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/static/images/jakresit_1.svg | 322 +++++++++++----------------- 1 file changed, 125 insertions(+), 197 deletions(-) diff --git a/mamweb/static/images/jakresit_1.svg b/mamweb/static/images/jakresit_1.svg index 36a6b7c7..514e3221 100644 --- a/mamweb/static/images/jakresit_1.svg +++ b/mamweb/static/images/jakresit_1.svg @@ -1,20 +1,21 @@ + inkscape:version="1.1 (c68e22c387, 2021-05-23)" + sodipodi:docname="jakresit_1.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:ns10="http://www.iki.fi/pav/software/textext/"> + id="base" + inkscape:pagecheckerboard="0"> image/svg+xml - @@ -11912,7 +11913,7 @@ ns10:version="1.0.1" ns10:texconverter="pdflatex" ns10:pdfconverter="inkscape" - ns10:text="\\begin{minipage}{9cm}\n\\nadpis{\n\\faLightbulbO \\textbf{ Tipy}\n}\n\\vspace{-2 mm}\n\\podnadpis{\n\\begin{itemize}\n\\item P\u0159e\u010dti si v\u0161echna zad\xe1n\xed v \u010d\xedsle.\n\\item \u0158e\u0161 v\xedce t\xe9mat najednou, dozv\xed\u0161 se n\u011bco nov\xe9ho z r\u016fzn\xfdch oblast\xed.\n\\item Ptej se!\n\\begin{itemize}[leftmargin=*]\n\\item Ke ka\u017ed\xe9mu t\xe9m\xe1tku existuje e-mailov\xe1 konference,\nkde m\u016f\u017ee\u0161 diskutovat s ostatn\xedmi \u0159e\u0161iteli \u010di se pt\xe1t na nejasnosti.\n\\item St\xe1le nev\xed\u0161? Napi\u0161 p\u0159\xedmo vedouc\xedmu t\xe9m\xe1tka, r\xe1d ti porad\xed.\n\\end{itemize}\n\\item M\u016f\u017eu googlit?\n\\begin{itemize}[leftmargin=*]\n\\item Ano! Pokud v\u0161ak nebude uvedeno jinak, nehledej pros\xedm p\u0159\xedmo \u0159e\u0161en\xed\nzadan\xfdch \xfaloh, mohl(a) by ses tak ochudit o radost z objevov\xe1n\xed. \n\\end{itemize}\n\\item S odevzd\xe1n\xedm neot\xe1lej\n\\begin{itemize}[leftmargin=*]\n\\item Stihneme-li ti \u0159e\u0161en\xed opravit p\u0159ed 1.~deadlinem, m\u016f\u017ee\u0161 si jej je\u0161t\u011b zlep\u0161it.\n\\end{itemize}\n\\end{itemize}\n}\n\\end{minipage}" + ns10:text="\\begin{minipage}{9cm}\n\\nadpis{\n\\faLightbulbO \\textbf{ Tipy}\n}\n\\vspace{-2 mm}\n\\podnadpis{\n\\begin{itemize}\n\\item P\u0159e\u010dti si v\u0161echna zad\xe1n\xed v \u010d\xedsle.\n\\item \u0158e\u0161 v\xedce t\xe9mat najednou, dozv\xed\u0161 se n\u011bco nov\xe9ho z r\u016fzn\xfdch oblast\xed.\n\\item Ptej se!\n\\begin{itemize}[leftmargin=*]\n\\item Ke ka\u017ed\xe9mu t\xe9m\xe1tku existuje discordový kanál,\nkde m\u016f\u017ee\u0161 diskutovat s ostatn\xedmi \u0159e\u0161iteli \u010di se pt\xe1t na nejasnosti.\n\\item St\xe1le nev\xed\u0161? Napi\u0161 p\u0159\xedmo vedouc\xedmu t\xe9m\xe1tka, r\xe1d ti porad\xed.\n\\end{itemize}\n\\item M\u016f\u017eu googlit?\n\\begin{itemize}[leftmargin=*]\n\\item Ano! Pokud v\u0161ak nebude uvedeno jinak, nehledej pros\xedm p\u0159\xedmo \u0159e\u0161en\xed\nzadan\xfdch \xfaloh, mohl(a) by ses tak ochudit o radost z objevov\xe1n\xed. \n\\end{itemize}\n\\item S odevzd\xe1n\xedm neot\xe1lej\n\\begin{itemize}[leftmargin=*]\n\\item Stihneme-li ti \u0159e\u0161en\xed opravit p\u0159ed 1.~deadlinem, m\u016f\u017ee\u0161 si jej je\u0161t\u011b zlep\u0161it.\n\\end{itemize}\n\\end{itemize}\n}\n\\end{minipage}" ns10:preamble="/home/katerina/.config/inkscape/extensions/textext/default_packages.tex" ns10:scale="1.0" ns10:alignment="middle center" @@ -13802,188 +13803,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + style="fill:#000000;fill-opacity:1" /> - - - - - - - - - - - - - - - - - - - - - - - - - - + id="g54393" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + From 54f16f358f267c6a7757bab558be7232df64016d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 29 Jun 2022 19:50:25 +0200 Subject: [PATCH 2/6] =?UTF-8?q?Klikac=C3=AD=20jak=20=C5=99e=C5=A1it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/static/css/mamweb.css | 4 ++-- mamweb/{static/images => templates}/jakresit_1.svg | 0 mamweb/{static/images => templates}/jakresit_2.svg | 0 mamweb/{static/images => templates}/jakresit_3.svg | 0 seminar/templates/seminar/jak-resit.html | 6 +++--- 5 files changed, 5 insertions(+), 5 deletions(-) rename mamweb/{static/images => templates}/jakresit_1.svg (100%) rename mamweb/{static/images => templates}/jakresit_2.svg (100%) rename mamweb/{static/images => templates}/jakresit_3.svg (100%) diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 069eb39f..fa5de880 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -1190,14 +1190,14 @@ div.gdpr { /* Jak řešit */ -.jakresit img { +.jakresit svg { width: 33%; padding: 10px; filter: none; } @media(max-width: 860px) { - .jakresit img { + .jakresit svg { margin: auto; display: grid; width: 100%; diff --git a/mamweb/static/images/jakresit_1.svg b/mamweb/templates/jakresit_1.svg similarity index 100% rename from mamweb/static/images/jakresit_1.svg rename to mamweb/templates/jakresit_1.svg diff --git a/mamweb/static/images/jakresit_2.svg b/mamweb/templates/jakresit_2.svg similarity index 100% rename from mamweb/static/images/jakresit_2.svg rename to mamweb/templates/jakresit_2.svg diff --git a/mamweb/static/images/jakresit_3.svg b/mamweb/templates/jakresit_3.svg similarity index 100% rename from mamweb/static/images/jakresit_3.svg rename to mamweb/templates/jakresit_3.svg diff --git a/seminar/templates/seminar/jak-resit.html b/seminar/templates/seminar/jak-resit.html index 4404b53e..b418f5cc 100644 --- a/seminar/templates/seminar/jak-resit.html +++ b/seminar/templates/seminar/jak-resit.html @@ -8,9 +8,9 @@
- - - +{% include 'jakresit_1.svg' %} +{% include 'jakresit_2.svg' %} +{% include 'jakresit_3.svg' %}
{% endblock %} From 3663e04452057ec476e5470f071da2fc3255dd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 7 Jul 2022 20:56:44 +0200 Subject: [PATCH 3/6] =?UTF-8?q?Tla=C4=8D=C3=ADtko=20neodhla=C5=A1ovat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- various/autentizace/forms.py | 16 ++++++++++++++++ various/autentizace/views.py | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 various/autentizace/forms.py diff --git a/various/autentizace/forms.py b/various/autentizace/forms.py new file mode 100644 index 00000000..f3138d74 --- /dev/null +++ b/various/autentizace/forms.py @@ -0,0 +1,16 @@ +""" +Formuláře (:class:`django.forms.Form`) umožňují jednoduchou tvorbu formulářů, +které lze pak jednoduše dát do frontendu i zpracovat na backendu. + +Pro přidání políčka do formuláře je potřeba + - mít v modelu tu položku, kterou chci upravovat + - přidat do views (prihlaskaView, resitelEditView) + - přidat do forms + - includovat do html +""" + +from django.contrib.auth.forms import AuthenticationForm +from django.forms import BooleanField + +class LoginForm(AuthenticationForm): + disable_logout = BooleanField(label="Neodhlašovat", required=False) diff --git a/various/autentizace/views.py b/various/autentizace/views.py index 85ed3528..7bedb755 100644 --- a/various/autentizace/views.py +++ b/various/autentizace/views.py @@ -1,10 +1,23 @@ +from django.http import HttpResponseRedirect from django.urls import reverse_lazy from django.contrib.auth import views as auth_views +from django.contrib.auth import login as auth_login + +from various.autentizace.forms import LoginForm + class LoginView(auth_views.LoginView): # Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL template_name = 'autentizace/login.html' + authentication_form = LoginForm + + def form_valid(self, form): + """ Okopírováno z django/contrib/auth/views.py s přidáním nekonečného přihlášení """ + auth_login(self.request, form.get_user()) + if form.cleaned_data["disable_logout"]: + form.request.session.set_expiry(2**32) # infinity (asi 100 let)... + return HttpResponseRedirect(self.get_success_url()) class LogoutView(auth_views.LogoutView): From 57e1f22e9d8fe448d4527f220578b854f26a0aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 7 Jul 2022 21:09:02 +0200 Subject: [PATCH 4/6] =?UTF-8?q?=E2=88=9E=20->=20rok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- various/autentizace/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/various/autentizace/views.py b/various/autentizace/views.py index 7bedb755..dd5b3ae6 100644 --- a/various/autentizace/views.py +++ b/various/autentizace/views.py @@ -16,7 +16,7 @@ class LoginView(auth_views.LoginView): """ Okopírováno z django/contrib/auth/views.py s přidáním nekonečného přihlášení """ auth_login(self.request, form.get_user()) if form.cleaned_data["disable_logout"]: - form.request.session.set_expiry(2**32) # infinity (asi 100 let)... + form.request.session.set_expiry(365 * 24 * 3600) # rok return HttpResponseRedirect(self.get_success_url()) From e643174f5f5a0b3b455706a74ee1b0011d3671c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 7 Jul 2022 21:10:46 +0200 Subject: [PATCH 5/6] =?UTF-8?q?Odhla=C5=A1ov=C3=A1n=C3=AD=20po=20zav=C5=99?= =?UTF-8?q?en=C3=AD=20prohl=C3=AD=C5=BEe=C4=8De?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/settings_common.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 54e0c6f1..fe2fe3fd 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -48,6 +48,11 @@ STATICFILES_FINDERS = ( LOGIN_URL = 'login' LOGIN_REDIRECT_URL = 'profil' +# Odhlášení po zavření prohlížeče +# (pozor nefunguje na firefox se znovuotevíráním oken po startu firefoxu) +# default je False a SESSION_COOKIE_AGE = 3600*24*14 = 2 týdny +SESSION_EXPIRE_AT_BROWSER_CLOSE = True + # Modules configuration AUTHENTICATION_BACKENDS = ( From 4dfe3bef7bb741097297596f4d6d56f30d6278eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 7 Jul 2022 21:16:03 +0200 Subject: [PATCH 6/6] =?UTF-8?q?Doba=20pro=20neodhla=C5=A1ov=C3=A1n=C3=AD?= =?UTF-8?q?=20p=C5=99esunuta=20do=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/settings_common.py | 1 + various/autentizace/views.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index fe2fe3fd..baebe3b4 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -52,6 +52,7 @@ LOGIN_REDIRECT_URL = 'profil' # (pozor nefunguje na firefox se znovuotevíráním oken po startu firefoxu) # default je False a SESSION_COOKIE_AGE = 3600*24*14 = 2 týdny SESSION_EXPIRE_AT_BROWSER_CLOSE = True +DOBA_ODHLASENI_PRI_ZASKRTNUTI_NEODHLASOVAT = 365 * 24 * 3600 # rok # Modules configuration diff --git a/various/autentizace/views.py b/various/autentizace/views.py index dd5b3ae6..73b51c54 100644 --- a/various/autentizace/views.py +++ b/various/autentizace/views.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.http import HttpResponseRedirect from django.urls import reverse_lazy from django.contrib.auth import views as auth_views @@ -16,7 +17,7 @@ class LoginView(auth_views.LoginView): """ Okopírováno z django/contrib/auth/views.py s přidáním nekonečného přihlášení """ auth_login(self.request, form.get_user()) if form.cleaned_data["disable_logout"]: - form.request.session.set_expiry(365 * 24 * 3600) # rok + form.request.session.set_expiry(settings.DOBA_ODHLASENI_PRI_ZASKRTNUTI_NEODHLASOVAT) return HttpResponseRedirect(self.get_success_url())