From ffa0c682f425427a275556c11386a3c500580780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 20:16:04 +0100 Subject: [PATCH 01/31] =?UTF-8?q?Pokus=20o=20=C5=99e=C5=A1en=C3=AD=20probl?= =?UTF-8?q?=C3=A9m=C5=AF=20s=20v=C3=BDsledkovkou=20posledn=C3=ADho=20?= =?UTF-8?q?=C4=8D=C3=ADsla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/templates/seminar/archiv/cislo.html | 6 ++++-- seminar/templates/seminar/archiv/rocnik.html | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/seminar/templates/seminar/archiv/cislo.html b/seminar/templates/seminar/archiv/cislo.html index b8edce90..fa34e965 100644 --- a/seminar/templates/seminar/archiv/cislo.html +++ b/seminar/templates/seminar/archiv/cislo.html @@ -38,9 +38,11 @@

Orgovské odkazy

{% endif %} diff --git a/seminar/templates/seminar/archiv/rocnik.html b/seminar/templates/seminar/archiv/rocnik.html index 66336086..fd2a99b6 100644 --- a/seminar/templates/seminar/archiv/rocnik.html +++ b/seminar/templates/seminar/archiv/rocnik.html @@ -120,8 +120,7 @@ {% if user.je_org %}

Výsledkovka ročníku (LaTeX, včetně neveřejných)

-

Tituly (TeX, do konce ročníku = pro poslední číslo)

-

Výsledkovka posledního čísla

+

Tituly (TeX, včetně neveřejných, všechny, nevhodné do mamtexu)

{# FIXME: Sice to sem asi nepatří sémanticky, ale bylo to nejjednodušší… #}

CSV export řešitelů

Výsledková listina včetně neveřejných bodů

From 6cb41a1263a24a0a268d56033952a8fff88d0001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:07:18 +0100 Subject: [PATCH 02/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20django=20comments,?= =?UTF-8?q?=20data=20jsou=20v=20/akce/mam/www/old=5Fdata/django=5Fcomments?= =?UTF-8?q?.json.gz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/settings_common.py | 1 - mamweb/static/css/mamweb.css | 9 --------- mamweb/urls.py | 4 ---- requirements.txt | 3 --- seminar/templates/seminar/archiv/problem.html | 6 ------ treenode/templates/treenode/orphanage.html | 2 -- 6 files changed, 25 deletions(-) diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index d6ed2852..1c7bafab 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -121,7 +121,6 @@ INSTALLED_APPS = ( 'dal_select2', 'crispy_forms', - 'django_comments', 'django.contrib.flatpages', 'django.contrib.humanize', diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 84e4c79b..e6839727 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -199,15 +199,6 @@ h1 { margin-top: 0px; } - - -/* Comments */ - -#id_comment { - width: 100%; - height: 6em; -} - /* Headline & Header */ #title { /*dělá blbosti šířka, je to kvůli fixed pozici, zatím natvrdo, vyřešit*/ diff --git a/mamweb/urls.py b/mamweb/urls.py index 9ef2750a..cdd7df09 100644 --- a/mamweb/urls.py +++ b/mamweb/urls.py @@ -13,7 +13,6 @@ Soubor sloužící jako základní „router“, tj. zde se includují veškeré - :mod:`api.urls` - :mod:`treenode.urls` - :mod:`aesop.urls` -- ``comments_dj/`` :mod:`django_comments.urls` """ from django.urls import path, include from django.contrib.staticfiles.urls import staticfiles_urlpatterns @@ -62,9 +61,6 @@ urlpatterns = [ # Aesop (ma vlastni podadresare) path('', include('aesop.urls')), - # Comments (interni i verejne) - path('comments_dj/', include('django_comments.urls')), - # REST API # path('api/', include(router.urls)), diff --git a/requirements.txt b/requirements.txt index 53c528ab..2e5d9761 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,9 +35,6 @@ django-rest-framework django-webpack-loader django-rest-polymorphic -# Comments -django-contrib-comments - # debug tools/extensions django-debug-toolbar diff --git a/seminar/templates/seminar/archiv/problem.html b/seminar/templates/seminar/archiv/problem.html index 1aa94219..cae8f56c 100644 --- a/seminar/templates/seminar/archiv/problem.html +++ b/seminar/templates/seminar/archiv/problem.html @@ -1,7 +1,5 @@ {% extends "base.html" %} -{% load comments %} - {% block content %}
{% block problem %} @@ -13,10 +11,6 @@

Text - org

{{ problem.text_org |safe }} -

Diskuse - org

- {% render_comment_list for object %} - {% render_comment_form for object %} -
{% endif %} diff --git a/treenode/templates/treenode/orphanage.html b/treenode/templates/treenode/orphanage.html index 6408749e..31a20e6d 100644 --- a/treenode/templates/treenode/orphanage.html +++ b/treenode/templates/treenode/orphanage.html @@ -12,8 +12,6 @@ dfsdfs {% endblock custom_css %} -{% load comments %} - {% block content %}
    {% for obj in object_list %} From 3fd0c7f917586dad9c0019636a16235cbd37ae54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:17:12 +0100 Subject: [PATCH 03/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20six=20(knihovna=20?= =?UTF-8?q?pro=20p=C5=99echod=20mezi=20python2=20a=20python3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2e5d9761..ca6b0a6a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,6 @@ ipython Pillow pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 pytz -six pexpect traitlets Unidecode From 0204bd2444736979ff7159c8a9921e0221128c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:25:36 +0100 Subject: [PATCH 04/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20pytz=20(pou=C5=BEi?= =?UTF-8?q?t=20pouze=20v=20testdatech,=20ale=20tam=20naopak=20budeme=20l?= =?UTF-8?q?=C3=A9pe=20simulovat=20aktu=C3=A1ln=C3=AD=20stav,=20kdy=C5=BE?= =?UTF-8?q?=20tam=20nacpeme=20UTC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 - seminar/templatetags/utils.py | 1 - seminar/testutils.py | 5 ++--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index ca6b0a6a..df4ea6ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ html5lib ipython Pillow pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 -pytz pexpect traitlets Unidecode diff --git a/seminar/templatetags/utils.py b/seminar/templatetags/utils.py index 4ba33a0e..ca400050 100644 --- a/seminar/templatetags/utils.py +++ b/seminar/templatetags/utils.py @@ -1,7 +1,6 @@ from django import template from django.utils.safestring import mark_safe from datetime import datetime, timedelta -from pytz import timezone from mamweb.settings import TIME_ZONE import logging register = template.Library() diff --git a/seminar/testutils.py b/seminar/testutils.py index 7076d5f0..c3d64f56 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -4,7 +4,6 @@ import datetime from django.contrib.auth.models import Permission from django.contrib.auth.models import Group -from pytz import timezone import random import lorem import django.contrib.auth @@ -177,13 +176,13 @@ def gen_organizatori(rnd, osoby, last_rocnik): year=1993 + pusobnost, month=rnd.randint(1, 12), day=rnd.randint(1, 28), - tzinfo=timezone('CET'), + tzinfo=datetime.timezone.utc, ) do = datetime.datetime( year=od.year + rnd.randint(1, 6), month=rnd.randint(1, 12), day=rnd.randint(1, 28), - tzinfo=timezone('CET'), + tzinfo=datetime.timezone.utc, ) #aktualni organizatori jeste nemaji vyplnene organizuje_do From b5de60d681b92cfdd6b95278d687b6780359a3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:26:56 +0100 Subject: [PATCH 05/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20html5lib=20(pro=20?= =?UTF-8?q?parsov=C3=A1n=C3=AD=20html=20v=20Pythonu,=20nepou=C5=BE=C3=ADva?= =?UTF-8?q?n=C3=A1,=20nav=C3=ADc=20u=C5=BE=203=20roky=20neudr=C5=BEovan?= =?UTF-8?q?=C3=A1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index df4ea6ce..2cff57b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ # basic libs psycopg2 -html5lib ipython Pillow pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 From 3bfdde10e8b2fa885ccfde1c2ec36a39699d9e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:30:09 +0100 Subject: [PATCH 06/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20pexpect=20(knihovn?= =?UTF-8?q?a=20pro=20spawnov=C3=A1n=C3=AD=20podproces=C5=AF=20z=20pythonu,?= =?UTF-8?q?=20nepou=C5=BE=C3=ADvan=C3=A1=3F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2cff57b1..97f95e53 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ psycopg2 ipython Pillow pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 -pexpect traitlets Unidecode From 191177aea09a774d683a3117ad4c6590184de8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:33:07 +0100 Subject: [PATCH 07/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20traitlets=20(kontr?= =?UTF-8?q?ola=20typov=C3=A1n=C3=AD,=20ale=20pokud=20spr=C3=A1vn=C4=9B=20c?= =?UTF-8?q?h=C3=A1pu,=20tak=20n=C4=9Bjak=C3=A9ho=20sv=C3=A9ho)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 97f95e53..1026bbf2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ psycopg2 ipython Pillow pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 -traitlets Unidecode # Django and modules From 0f3874beb57829f37f518c822bffadc67e7d4c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:49:14 +0100 Subject: [PATCH 08/31] =?UTF-8?q?N=C4=9Bjak=C3=A9=20koment=C3=A1=C5=99e=20?= =?UTF-8?q?k=20requirements.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1026bbf2..ca8a8e72 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ -c constraints.txt # basic libs -psycopg2 -ipython +psycopg2 # PostgreSQL adaptér +ipython # Interaktivní shell +Unidecode # Přepisuje unicode do ASCII (např. soubory nebo e-maily) Pillow pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 -Unidecode # Django and modules From 1802e909523a6397bd89d598050db47610b33aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:51:20 +0100 Subject: [PATCH 09/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20django-mptt=20(kni?= =?UTF-8?q?hovna=20pro=20stromy=20v=20Djangu,=20nap=C5=99.=20v=20adminu,?= =?UTF-8?q?=20na=20prvn=C3=AD=20pohled=20nepou=C5=BE=C3=ADvan=C3=A1,=20nav?= =?UTF-8?q?=C3=ADc=20unmaintained)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ca8a8e72..d91220cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,6 @@ pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 Django<5.0 #django-bootstrap-sass -django-mptt django-reversion django-sekizai django-countries From 7a28649436c7deeef474e3cccd9df45e5b735c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 21:59:13 +0100 Subject: [PATCH 10/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20django-flat-theme?= =?UTF-8?q?=20(d=C3=A1vno,=20d=C3=A1vno,=20p=C5=99ed=C3=A1vno=20(Django=20?= =?UTF-8?q?1.9)=20includovan=C3=A9=20do=20Djanga)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d91220cc..bf0ed683 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,6 @@ django-countries django-solo django-ckeditor django-cleanup # Uklízí media/ od smazaných „databázových“ souborů -django-flat-theme django-taggit django-autocomplete-light>=3.9.0 django-crispy-forms From 187ca0ec93f5147efeb32216a554eddf9bee545e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 22:02:22 +0100 Subject: [PATCH 11/31] =?UTF-8?q?Dal=C5=A1=C3=AD=20koment=C3=A1=C5=99e=20v?= =?UTF-8?q?=20requirements.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index bf0ed683..ac63f0ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,16 +11,16 @@ pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 Django<5.0 #django-bootstrap-sass -django-reversion -django-sekizai -django-countries -django-solo -django-ckeditor +django-reversion # Version control na datech v databázi +django-sekizai # Vylepšení bloků v templatech +django-countries # Políčko ve formu / field v modelu ohledně států +django-solo # Singleton model (speciálně Nastavení) +django-ckeditor # Editor htmlka (hlavně v adminu u flatpages) django-cleanup # Uklízí media/ od smazaných „databázových“ souborů django-taggit django-autocomplete-light>=3.9.0 django-crispy-forms -django-imagekit +django-imagekit # Všechny možné obrázky v Djangu django-polymorphic django-sitetree django_reverse_admin From ea5ee85e7a789c0b2ad7e482e06c76c3508ac172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 22:03:42 +0100 Subject: [PATCH 12/31] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20django-crispy-form?= =?UTF-8?q?s=20(n=C4=9Bjak=C3=A9=20fancy=20formy,=20ale=20vypad=C3=A1=20ne?= =?UTF-8?q?pou=C5=BE=C3=ADvan=C4=9B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/settings_common.py | 2 -- requirements.txt | 1 - 2 files changed, 3 deletions(-) diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 1c7bafab..42acf0d7 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -120,8 +120,6 @@ INSTALLED_APPS = ( 'dal', 'dal_select2', - 'crispy_forms', - 'django.contrib.flatpages', 'django.contrib.humanize', diff --git a/requirements.txt b/requirements.txt index ac63f0ef..6f6ea3f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,6 @@ django-ckeditor # Editor htmlka (hlavně v adminu u flatpages) django-cleanup # Uklízí media/ od smazaných „databázových“ souborů django-taggit django-autocomplete-light>=3.9.0 -django-crispy-forms django-imagekit # Všechny možné obrázky v Djangu django-polymorphic django-sitetree From 8babbd988cc08cfba3065335889b23e431b92713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 11 Dec 2023 22:20:38 +0100 Subject: [PATCH 13/31] =?UTF-8?q?A=20dal=C5=A1=C3=AD=20koment=C3=A1=C5=99e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6f6ea3f8..b165c781 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,12 +17,12 @@ django-countries # Políčko ve formu / field v modelu ohledně států django-solo # Singleton model (speciálně Nastavení) django-ckeditor # Editor htmlka (hlavně v adminu u flatpages) django-cleanup # Uklízí media/ od smazaných „databázových“ souborů -django-taggit -django-autocomplete-light>=3.9.0 +django-taggit # Taggy v djangu (speciálně zaměření problémů) +django-autocomplete-light>=3.9.0 # Automatické doplňování (problémů, účastníků, …) ve formulářích django-imagekit # Všechny možné obrázky v Djangu -django-polymorphic -django-sitetree -django_reverse_admin +django-polymorphic # Polymorfismus na django modelech (hlavně Problém nebo treenode) +django-sitetree # Struktura stránek, hlavně pro meníčko +django_reverse_admin # Lepší handlování OneToOne fieldů v adminu django-rest-framework django-webpack-loader django-rest-polymorphic From 46fd51e7d927a5c1739a1484ec100da8e7fa06d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 18 Dec 2023 21:24:14 +0100 Subject: [PATCH 14/31] =?UTF-8?q?Odstran=C4=9Bno=20sekizai=20(nepou=C5=BE?= =?UTF-8?q?=C3=ADvalo=20se,=20zbyte=C4=8Dn=C4=9B=20zeslo=C5=BEi=C5=A5uje,?= =?UTF-8?q?=20jde=20to=20d=C4=9Blat=20i=20jinak=20a=20h=C3=A1zelo=20n?= =?UTF-8?q?=C4=9Bkdy=20n=C4=9Bkde=20chyby)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/settings_common.py | 2 -- mamweb/templates/base.html | 5 ++--- requirements.txt | 1 - treenode/templates/treenode/orphanage.html | 7 ------- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 42acf0d7..d5b35281 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -87,7 +87,6 @@ TEMPLATES = [ 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.request', 'django.contrib.messages.context_processors.messages', - 'sekizai.context_processors.sekizai', 'header_fotky.context_processors.vzhled', 'various.context_processors.rozliseni', 'various.context_processors.april', @@ -110,7 +109,6 @@ INSTALLED_APPS = ( 'django.contrib.auth', # Utilities - 'sekizai', 'reversion', 'django_countries', 'solo', diff --git a/mamweb/templates/base.html b/mamweb/templates/base.html index 4281c6df..a29d4697 100644 --- a/mamweb/templates/base.html +++ b/mamweb/templates/base.html @@ -1,4 +1,4 @@ -{% load static sekizai_tags %} +{% load static %} {% load sitetree %} @@ -7,7 +7,6 @@ {% block title %}{% block nadpis1a %}🦊{% endblock %} | Korespondenční seminář M&M{% endblock title %} -{# {% render_block css %}#} {% block custom_css %}{% endblock %} @@ -189,6 +188,6 @@ walkText(document.body); {% endif %} - {% render_block "js" %} + {% block js %}{% endblock %} diff --git a/requirements.txt b/requirements.txt index b165c781..6855e0ae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,6 @@ pilkit>=3.0 # Kvůli kompatibilitě s Pillow>=10.0.0 Django<5.0 #django-bootstrap-sass django-reversion # Version control na datech v databázi -django-sekizai # Vylepšení bloků v templatech django-countries # Políčko ve formu / field v modelu ohledně států django-solo # Singleton model (speciálně Nastavení) django-ckeditor # Editor htmlka (hlavně v adminu u flatpages) diff --git a/treenode/templates/treenode/orphanage.html b/treenode/templates/treenode/orphanage.html index 31a20e6d..53d4ed67 100644 --- a/treenode/templates/treenode/orphanage.html +++ b/treenode/templates/treenode/orphanage.html @@ -1,12 +1,5 @@ {% extends "seminar/archiv/base.html" %} {% load static %} -{% load sekizai_tags %} - -{# toto z nejakeho duvodu nefunguje #} -{% addtoblock css %} -dfsdfs - -{% endaddtoblock "css" %} {% block custom_css %} From 824a4d9eb3e313186399149935b75ab05a3e6677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 18 Dec 2023 22:13:17 +0100 Subject: [PATCH 15/31] =?UTF-8?q?Fixnuto=20p=C5=99et=C3=A9k=C3=A1n=C3=AD?= =?UTF-8?q?=20select=C5=AF=20p=C5=99es=20title=20a=20login=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/static/css/mamweb.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 84e4c79b..6847ba69 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -39,7 +39,7 @@ div.login-bar { position: fixed; margin-top: -20px; min-height: 20px; - z-index: 20; + z-index: 4086; padding-left: 5px; padding-right: 5px; @@ -214,7 +214,7 @@ h1 { height: 55px; width: 970px; position: fixed; - z-index: 10; + z-index: 2048; background-color: #e84e10; filter: drop-shadow(0px 5px 5px rgba(0, 0, 0, 0.4)); From 8e1a03863fd1f54377a7060f3dd519781597dffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 28 Dec 2023 09:50:13 +0100 Subject: [PATCH 16/31] =?UTF-8?q?PLS,=20Windowsy=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 6855e0ae..4a7163d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- -c constraints.txt # basic libs From a72435dd724b0a2a394a8a77973b4ce2d60f4d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 30 Jan 2024 00:02:27 +0100 Subject: [PATCH 17/31] =?UTF-8?q?Zrychlen=C3=AD=20na=C4=8D=C3=ADt=C3=A1n?= =?UTF-8?q?=C3=AD=20archivu=20soust=C5=99ed=C4=9Bn=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/soustredeni/seznam_soustredeni.html | 8 ++++---- soustredeni/views.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/soustredeni/templates/soustredeni/seznam_soustredeni.html b/soustredeni/templates/soustredeni/seznam_soustredeni.html index fcb7c287..e5f68bfc 100644 --- a/soustredeni/templates/soustredeni/seznam_soustredeni.html +++ b/soustredeni/templates/soustredeni/seznam_soustredeni.html @@ -58,16 +58,16 @@ {# Účastníci #}

    Soustředění se zúčastnili tito účastníci:

    - {% for i in soustredeni.soustredeni_ucastnici_set.all %} - {{i.resitel}}{% if forloop.last %}.{% else %},{% endif %} + {% for i in soustredeni.ucastnici.all %} + {{i}}{% if forloop.last %}.{% else %},{% endif %} {% empty %} Nic! {% endfor %}

    Soustředění se účastnili tito organizátoři:

    - {% for i in soustredeni.soustredeni_organizatori_set.all %} - {{i.organizator}}{% if forloop.last %}.{% else %},{% endif %} + {% for i in soustredeni.organizatori.all %} + {{i}}{% if forloop.last %}.{% else %},{% endif %} {% empty %} Nic! {% endfor %} diff --git a/soustredeni/views.py b/soustredeni/views.py index e5ae2992..da59e779 100644 --- a/soustredeni/views.py +++ b/soustredeni/views.py @@ -17,6 +17,17 @@ class SoustredeniListView(generic.ListView): model = Soustredeni template_name = 'soustredeni/seznam_soustredeni.html' + def get_queryset(self): + return ( + Soustredeni.objects + .prefetch_related( + "ucastnici", "ucastnici__osoba", + "organizatori", "organizatori__osoba", + "galerie_set" + ) + .select_related("rocnik") + ) + def soustredeniObalkyView(request, soustredeni): soustredeni = get_object_or_404(Soustredeni, id=soustredeni) From c130ab842649e3d5f9028dcb2131526c44822ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 30 Jan 2024 00:11:13 +0100 Subject: [PATCH 18/31] =?UTF-8?q?Zrychlen=C3=AD=20na=C4=8D=C3=ADt=C3=A1n?= =?UTF-8?q?=C3=AD=20archivu=20soust=C5=99ed=C4=9Bn=C3=AD=20pro=20=C3=BA?= =?UTF-8?q?=C4=8Dastn=C3=ADky?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soustredeni/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/soustredeni/views.py b/soustredeni/views.py index da59e779..f2aafdf7 100644 --- a/soustredeni/views.py +++ b/soustredeni/views.py @@ -18,12 +18,14 @@ class SoustredeniListView(generic.ListView): template_name = 'soustredeni/seznam_soustredeni.html' def get_queryset(self): + if not self.request.user.je_org: + return super().get_queryset() return ( Soustredeni.objects .prefetch_related( "ucastnici", "ucastnici__osoba", "organizatori", "organizatori__osoba", - "galerie_set" + "galerie_set", ) .select_related("rocnik") ) From b4c693a9ab3c64618028c127728105b42ad0a03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 5 Feb 2024 19:50:17 +0100 Subject: [PATCH 19/31] =?UTF-8?q?Uchycen=C3=AD=20=C5=99=C3=A1dku=20a=20slo?= =?UTF-8?q?upce=20v=20tabulce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/static/css/mamweb.css | 29 +++++++++++++++++++ .../templates/odevzdavatko/tabulka.html | 6 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 4b4a5e51..0d699d5c 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -1243,6 +1243,35 @@ div.gdpr { background: rgb(253, 237, 213); } +/*Přichycování prvního sloupce a řádku*/ +.dosla_reseni { + display: block; + max-height: 90vh; + max-width: 90vw; + overflow: auto; + margin-left: 5vw; +} + +.dosla_reseni thead tr { + position: sticky; + top: 0; + z-index: 1; +} + +.dosla_reseni tr:nth-child(even) td:first-child, .dosla_reseni thead tr, .dosla_reseni thead tr:first-child td:first-child { + background: rgb(253, 237, 213); +} + +.dosla_reseni tr:nth-child(odd) td:first-child { + background: #fffbf6; +} + +.dosla_reseni tr td:first-child { + position: sticky; + left: 0; +} +/* */ + .odevzdana_reseni tr th, .odevzdana_reseni tr td { border: 1px solid black; diff --git a/odevzdavatko/templates/odevzdavatko/tabulka.html b/odevzdavatko/templates/odevzdavatko/tabulka.html index 7cd317e5..7ee90ea9 100644 --- a/odevzdavatko/templates/odevzdavatko/tabulka.html +++ b/odevzdavatko/templates/odevzdavatko/tabulka.html @@ -21,8 +21,8 @@ Do data (včetně): {{ filtr.reseni_do }} -

    + {# Prázdná buňka v levém horním rohu #} {% for p in problemy %} @@ -32,6 +32,8 @@ Do data (včetně): {{ filtr.reseni_do }} {% endfor %} + + {% for resitel,hodnoty in radky%} {% endfor %} +
    @@ -52,8 +54,8 @@ Do data (včetně): {{ filtr.reseni_do }} {% endfor %}
    -
    {% endblock %} From c0a3e3df8f265011de3aa4404c3a71fb061f57ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 5 Feb 2024 20:08:25 +0100 Subject: [PATCH 20/31] =?UTF-8?q?Lep=C5=A1=C3=AD=20vy=C5=99e=C5=A1en=C3=AD?= =?UTF-8?q?=20rozli=C5=A1en=C3=AD=20web=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/static/css/rozliseni.css | 45 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/mamweb/static/css/rozliseni.css b/mamweb/static/css/rozliseni.css index baf2d837..52d2a481 100644 --- a/mamweb/static/css/rozliseni.css +++ b/mamweb/static/css/rozliseni.css @@ -1,29 +1,32 @@ /* Rozlišení mezi lokálním, test a produkčním webem */ -.localweb { - border-left: 20px solid greenyellow; - border-right: 20px solid greenyellow; +.localweb:before, .localweb:after { + content: ""; + position: fixed; + width: 20px; + height: 100%; + left: 0; + right: 0; + background: greenyellow; } -.localweb .login-bar { - margin-left: -20px; -} - -.testweb { - border-left: 20px solid darkorange; - border-right: 20px solid darkorange; -} - -.testweb .login-bar { - margin-left: -20px; +.testweb:before, .testweb:after { + content: ""; + position: fixed; + width: 20px; + height: 100%; + left: 0; + right: 0; + background: darkorange; } /* Produkční web z pohledu superuživatele */ -.suprodweb { - border-left: 20px solid red; - border-right: 20px solid red; -} - -.suprodweb .login-bar { - margin-left: -20px; +.suprodweb:before, .suprodweb:after { + content: ""; + position: fixed; + width: 20px; + height: 100%; + left: 0; + right: 0; + background: red; } From 239a324a191a63ebea8df4afde2cebc9f6279d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 5 Feb 2024 20:34:25 +0100 Subject: [PATCH 21/31] =?UTF-8?q?Je=C5=A1t=C4=9B=20lep=C5=A1=C3=AD=20vy?= =?UTF-8?q?=C5=99e=C5=A1en=C3=AD=20rozli=C5=A1en=C3=AD=20web=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/static/css/rozliseni.css | 35 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/mamweb/static/css/rozliseni.css b/mamweb/static/css/rozliseni.css index 52d2a481..35f52f88 100644 --- a/mamweb/static/css/rozliseni.css +++ b/mamweb/static/css/rozliseni.css @@ -1,32 +1,35 @@ /* Rozlišení mezi lokálním, test a produkčním webem */ -.localweb:before, .localweb:after { +body.localweb:before, body.localweb:after, +body.testweb:before, body.testweb:after, +body.suprodweb:before, body.suprodweb:after { content: ""; position: fixed; width: 20px; height: 100%; + top: 0; +} + +body.localweb:before, +body.testweb:before, +body.suprodweb:before { left: 0; +} + +body.localweb:after, +body.testweb:after, +body.suprodweb:after { right: 0; +} + +body.localweb:before, body.localweb:after { background: greenyellow; } -.testweb:before, .testweb:after { - content: ""; - position: fixed; - width: 20px; - height: 100%; - left: 0; - right: 0; +body.testweb:before, body.testweb:after { background: darkorange; } -/* Produkční web z pohledu superuživatele */ -.suprodweb:before, .suprodweb:after { - content: ""; - position: fixed; - width: 20px; - height: 100%; - left: 0; - right: 0; +body.suprodweb:before, body.suprodweb:after { background: red; } From a59e2f99777c36eb24f8c03909092fec10b17dd0 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Sun, 3 Mar 2024 22:44:59 +0100 Subject: [PATCH 22/31] =?UTF-8?q?U=C5=BEite=C4=8Dn=C3=A1=20chybov=C3=A1=20?= =?UTF-8?q?str=C3=A1nka=20pro=20ne=C3=BAsp=C4=9B=C5=A1n=C3=A9=20generov?= =?UTF-8?q?=C3=A1n=C3=AD=20ob=C3=A1lek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/views/views_all.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 318eee21..9dc03550 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -562,6 +562,11 @@ def cisloObalkyView(request, rocnik, cislo): def obalkyView(request, resitele): + if len(resitele) == 0: + return render(request, 'universal.html', { + 'title': 'Není pro koho vyrobit obálky.', + 'text': 'Právě ses pokusil/a vygenerovat obálky pro prázdnou množinu lidí. Můžeš to zkusit změnit, případně se zeptej webařů :-)', + }) tex = render(request,'seminar/archiv/obalky.tex', {'resitele': resitele}).content tempdir = tempfile.mkdtemp() From d2926bd1a7b577c5ec7a4afbae67f5ba24784e15 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Sun, 3 Mar 2024 23:05:39 +0100 Subject: [PATCH 23/31] =?UTF-8?q?Spr=C3=A1vn=C3=A9=20hled=C3=A1n=C3=AD=20l?= =?UTF-8?q?i=C5=A1=C3=A1ka=20pro=20ob=C3=A1lky?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/views/views_all.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 9dc03550..e345e45d 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -8,6 +8,7 @@ from django.http import Http404 from django.db.models import Q, Sum, Count from django.views.generic.base import RedirectView from django.core.exceptions import PermissionDenied +from django.contrib.staticfiles.finders import find import seminar.models as s import seminar.models as m @@ -572,7 +573,7 @@ def obalkyView(request, resitele): tempdir = tempfile.mkdtemp() with open(tempdir+"/obalky.tex","w") as texfile: texfile.write(tex.decode()) - shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/lisak.pdf'), tempdir) + shutil.copy(find('seminar/lisak.pdf'), tempdir) subprocess.call(["pdflatex","obalky.tex"], cwd = tempdir) with open(tempdir+"/obalky.pdf","rb") as pdffile: From 4ecd2a7a61509f7a1b7d50ebd1e87ba79ae3e127 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Sun, 3 Mar 2024 23:06:43 +0100 Subject: [PATCH 24/31] =?UTF-8?q?Je=C5=A1t=C4=9B=20status=20k=C3=B3d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/views/views_all.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index e345e45d..1d0d87ba 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -37,6 +37,7 @@ import unicodedata import logging import time from collections.abc import Sequence +import http from seminar.utils import aktivniResitele @@ -564,10 +565,14 @@ def cisloObalkyView(request, rocnik, cislo): def obalkyView(request, resitele): if len(resitele) == 0: - return render(request, 'universal.html', { - 'title': 'Není pro koho vyrobit obálky.', - 'text': 'Právě ses pokusil/a vygenerovat obálky pro prázdnou množinu lidí. Můžeš to zkusit změnit, případně se zeptej webařů :-)', - }) + return HttpResponse( + render(request, 'universal.html', { + 'title': 'Není pro koho vyrobit obálky.', + 'text': 'Právě ses pokusil/a vygenerovat obálky pro prázdnou množinu lidí. Můžeš to zkusit změnit, případně se zeptej webařů :-)', + }), + status=http.HTTPStatus.NOT_FOUND, + ) + tex = render(request,'seminar/archiv/obalky.tex', {'resitele': resitele}).content tempdir = tempfile.mkdtemp() From 213d3cc7b239ddedd3ff4c91fb20af63b910ca4e Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Sun, 3 Mar 2024 23:07:51 +0100 Subject: [PATCH 25/31] =?UTF-8?q?Lep=C5=A1=C3=AD=20vyr=C3=A1b=C4=9Bn=C3=AD?= =?UTF-8?q?=20do=C4=8Dasn=C3=BDch=20adres=C3=A1=C5=99=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chceme je po sobě nejspíš mazat i když to spadne. Možná to zesložití vývoj, ale je to odolnější proti náhodnému pádu čehokoliv. --- seminar/views/views_all.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 1d0d87ba..662c5025 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -575,15 +575,14 @@ def obalkyView(request, resitele): tex = render(request,'seminar/archiv/obalky.tex', {'resitele': resitele}).content - tempdir = tempfile.mkdtemp() - with open(tempdir+"/obalky.tex","w") as texfile: - texfile.write(tex.decode()) - shutil.copy(find('seminar/lisak.pdf'), tempdir) - subprocess.call(["pdflatex","obalky.tex"], cwd = tempdir) - - with open(tempdir+"/obalky.pdf","rb") as pdffile: - response = HttpResponse(pdffile.read(), content_type='application/pdf') - shutil.rmtree(tempdir) + with tempfile.TemporaryDirectory() as tempdir: + with open(tempdir+"/obalky.tex","w") as texfile: + texfile.write(tex.decode()) + shutil.copy(find('seminar/lisak.pdf'), tempdir) + subprocess.call(["pdflatex","obalky.tex"], cwd = tempdir) + + with open(tempdir+"/obalky.pdf","rb") as pdffile: + response = HttpResponse(pdffile.read(), content_type='application/pdf') return response From 88ae103ec11c5cfa874bd9bc915e44ba7946aae0 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Sun, 3 Mar 2024 23:09:18 +0100 Subject: [PATCH 26/31] =?UTF-8?q?Lep=C5=A1=C3=AD=20slo=C5=BEky=20i=20pro?= =?UTF-8?q?=20stvrzenky?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soustredeni/views.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/soustredeni/views.py b/soustredeni/views.py index f2aafdf7..899ee7f9 100644 --- a/soustredeni/views.py +++ b/soustredeni/views.py @@ -79,14 +79,14 @@ def soustredeniStvrzenkyView(request, soustredeni): castka = Nastaveni.get_solo().cena_sous tex = render(request, 'soustredeni/stvrzenky.tex', {'ucastnici': ucastnici, 'soustredeni': soustredeni, 'castka': castka}).content - tempdir = Path(tempfile.mkdtemp()) - with open(tempdir / "stvrzenky.tex", "w") as texfile: - texfile.write(tex.decode()) + with tempfile.TemporaryDirectory() as tempdirfn: + tempdir = Path(tempdirfn) + with open(tempdir / "stvrzenky.tex", "w") as texfile: + texfile.write(tex.decode()) - shutil.copy(find('images/logomm.pdf'), tempdir) - subprocess.call(["pdflatex", "stvrzenky.tex"], cwd = tempdir, stdout=subprocess.DEVNULL) + shutil.copy(find('images/logomm.pdf'), tempdir) + subprocess.call(["pdflatex", "stvrzenky.tex"], cwd = tempdir, stdout=subprocess.DEVNULL) - with open(tempdir / "stvrzenky.pdf", "rb") as pdffile: - response = HttpResponse(pdffile.read(), content_type='application/pdf') - shutil.rmtree(tempdir) + with open(tempdir / "stvrzenky.pdf", "rb") as pdffile: + response = HttpResponse(pdffile.read(), content_type='application/pdf') return response From a1000ad2bfbc5258f513b258d553f10386593a30 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Sun, 3 Mar 2024 23:11:51 +0100 Subject: [PATCH 27/31] =?UTF-8?q?Chybov=C3=A1=20hl=C3=A1=C5=A1ka=20i=20pro?= =?UTF-8?q?=20stvrzenky?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soustredeni/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/soustredeni/views.py b/soustredeni/views.py index 899ee7f9..f150b6b8 100644 --- a/soustredeni/views.py +++ b/soustredeni/views.py @@ -9,6 +9,7 @@ import tempfile import shutil import subprocess from pathlib import Path +import http from seminar.views import obalkyView @@ -76,6 +77,14 @@ def soustredeniUcastniciExportView(request, soustredeni): def soustredeniStvrzenkyView(request, soustredeni): soustredeni = get_object_or_404(Soustredeni, id=soustredeni) ucastnici = Resitel.objects.filter(soustredeni=soustredeni) + if ucastnici.count() == 0: + return HttpResponse( + render(request, 'universal.html', { + 'title': 'Není pro koho vyrobit stvrzenky.', + 'text': 'Právě ses pokusil/a vygenerovat stvrzenky pro prázdnou množinu lidí. Můžeš to zkusit změnit, případně se zeptej webařů :-)', + }), + status=http.HTTPStatus.NOT_FOUND, + ) castka = Nastaveni.get_solo().cena_sous tex = render(request, 'soustredeni/stvrzenky.tex', {'ucastnici': ucastnici, 'soustredeni': soustredeni, 'castka': castka}).content From a301b122fd3dc824fc1ad8dbdf59a7dd74d03410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Sun, 31 Mar 2024 19:12:24 +0200 Subject: [PATCH 28/31] =?UTF-8?q?Apr=C3=ADl=202024?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/templates/base.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mamweb/templates/base.html b/mamweb/templates/base.html index a29d4697..fafce9fa 100644 --- a/mamweb/templates/base.html +++ b/mamweb/templates/base.html @@ -188,6 +188,24 @@ walkText(document.body); {% endif %} + + {% if april == 2024 %} + + {% endif %} + {% block js %}{% endblock %} From 026efe2467646fc8aa95eba5c7f67da103ee310a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Sun, 14 Apr 2024 15:09:03 +0200 Subject: [PATCH 29/31] =?UTF-8?q?N=C3=A1pov=C4=9Bdy=20v=20=C5=A1ifrova?= =?UTF-8?q?=C4=8Dce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sifrovacka/admin.py | 4 +- sifrovacka/forms.py | 14 +++- .../0004_napoveda_napovezenoucastnikovi.py | 65 +++++++++++++++++++ sifrovacka/models.py | 17 +++++ sifrovacka/templates/sifrovacka/napoveda.html | 48 ++++++++++++++ .../templates/sifrovacka/napovedy_list.html | 23 +++++++ .../templates/sifrovacka/sifrovacka.html | 2 + sifrovacka/urls.py | 12 +++- sifrovacka/views.py | 27 +++++++- 9 files changed, 206 insertions(+), 6 deletions(-) create mode 100644 sifrovacka/migrations/0004_napoveda_napovezenoucastnikovi.py create mode 100644 sifrovacka/templates/sifrovacka/napoveda.html create mode 100644 sifrovacka/templates/sifrovacka/napovedy_list.html diff --git a/sifrovacka/admin.py b/sifrovacka/admin.py index 71d191d4..5099c241 100644 --- a/sifrovacka/admin.py +++ b/sifrovacka/admin.py @@ -1,8 +1,10 @@ from django.contrib import admin -from .models import OdpovedUcastnika, SpravnaOdpoved +from .models import OdpovedUcastnika, SpravnaOdpoved, NapovezenoUcastnikovi, Napoveda # Register your models here. admin.site.register(OdpovedUcastnika) admin.site.register(SpravnaOdpoved) +admin.site.register(Napoveda) +admin.site.register(NapovezenoUcastnikovi) diff --git a/sifrovacka/forms.py b/sifrovacka/forms.py index e3eba7c7..8a1e16d1 100644 --- a/sifrovacka/forms.py +++ b/sifrovacka/forms.py @@ -1,6 +1,6 @@ from django.core.exceptions import ValidationError from django.forms import ModelForm, Textarea -from .models import OdpovedUcastnika, SpravnaOdpoved +from .models import OdpovedUcastnika, SpravnaOdpoved, NapovezenoUcastnikovi, Napoveda class SifrovackaForm(ModelForm): @@ -16,3 +16,15 @@ class SifrovackaForm(ModelForm): if SpravnaOdpoved.objects.filter(sifra=sifra).count() == 0: raise ValidationError("Tohle číslo šifry v databázi nemáme. Zkontrolujte si ho prosím.") return sifra + + +class NapovedaForm(ModelForm): + class Meta: + model = NapovezenoUcastnikovi + fields = ["sifra",] + + def clean_sifra(self): + sifra = self.cleaned_data.get('sifra') + if Napoveda.objects.filter(sifra=sifra).count() == 0: + raise ValidationError("K tomuto číslu šifry nemáme nápovědu. Zkonstolujte si ho prosím.") + return sifra diff --git a/sifrovacka/migrations/0004_napoveda_napovezenoucastnikovi.py b/sifrovacka/migrations/0004_napoveda_napovezenoucastnikovi.py new file mode 100644 index 00000000..cba7ae8f --- /dev/null +++ b/sifrovacka/migrations/0004_napoveda_napovezenoucastnikovi.py @@ -0,0 +1,65 @@ +# Generated by Django 4.2.8 on 2024-04-14 12:57 + +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + dependencies = [ + ( + "seminar", + "0114_related_name_se_zmenilo_a_django_chce_migraci_tak_dostane_migraci", + ), + ("sifrovacka", "0003_odpoveducastnika_uspech"), + ] + + operations = [ + migrations.CreateModel( + name="Napoveda", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("text", models.TextField()), + ("sifra", models.IntegerField()), + ], + ), + migrations.CreateModel( + name="NapovezenoUcastnikovi", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("sifra", models.IntegerField(verbose_name="Číslo šifry")), + ( + "timestamp", + models.DateTimeField( + default=django.utils.timezone.now, verbose_name="Timestamp" + ), + ), + ( + "resitel", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="seminar.resitel", + ), + ), + ], + options={ + "ordering": ["-timestamp"], + }, + ), + ] diff --git a/sifrovacka/models.py b/sifrovacka/models.py index 6517c2e0..beabd0a7 100644 --- a/sifrovacka/models.py +++ b/sifrovacka/models.py @@ -25,3 +25,20 @@ class SpravnaOdpoved(models.Model): def __str__(self): return f"{self.sifra}: {self.odpoved}" + + +class NapovezenoUcastnikovi(models.Model): + class Meta: + ordering = ["-timestamp"] + + resitel = models.ForeignKey(Resitel, blank=False, null=False, on_delete=models.CASCADE) + sifra = models.IntegerField("Číslo šifry", blank=False, null=False,) + timestamp = models.DateTimeField("Timestamp", blank=False, null=False, default=timezone.now) + + +class Napoveda(models.Model): + text = models.TextField(blank=False, null=False,) + sifra = models.IntegerField(blank=False, null=False,) + + def __str__(self): + return f"{self.sifra}: {self.text}" diff --git a/sifrovacka/templates/sifrovacka/napoveda.html b/sifrovacka/templates/sifrovacka/napoveda.html new file mode 100644 index 00000000..88944216 --- /dev/null +++ b/sifrovacka/templates/sifrovacka/napoveda.html @@ -0,0 +1,48 @@ +{% extends "base.html" %} + +{% block content %} + +
    + +

    {% block nadpis1a %}M&Mí šifrovačka{% endblock nadpis1a %}

    + +
    + +

    Získat nápovědu k šifře:

    + +
    + + {{form.non_field_errors}} + {% for field in form %} + + + + + + + + + {% if field.errors %} + + + + {% endif %} + {% endfor %} +
    + + + + {{ field }} + {{ field.help_text|safe }} +
    {{ field.errors }}
    + + {% csrf_token %} + + +
    + + Nechceme nápovědu, známe řešení! + +{% endblock content %} diff --git a/sifrovacka/templates/sifrovacka/napovedy_list.html b/sifrovacka/templates/sifrovacka/napovedy_list.html new file mode 100644 index 00000000..dc729947 --- /dev/null +++ b/sifrovacka/templates/sifrovacka/napovedy_list.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} + +{% block content %} + +

    {% block nadpis1a %}Šifrovačka vzaté nápovědy{% endblock nadpis1a %}

    + + + + + + + + + {% for u in object_list %} + + + + + + {% endfor %} +
    TimestampŘešitelŠifra
    {{ u.timestamp }}{{ u.resitel }}{{ u.sifra }}
    + +{% endblock content %} diff --git a/sifrovacka/templates/sifrovacka/sifrovacka.html b/sifrovacka/templates/sifrovacka/sifrovacka.html index 4e0cc15a..74943406 100644 --- a/sifrovacka/templates/sifrovacka/sifrovacka.html +++ b/sifrovacka/templates/sifrovacka/sifrovacka.html @@ -43,4 +43,6 @@ + Získat nápovědu + {% endblock content %} diff --git a/sifrovacka/urls.py b/sifrovacka/urls.py index a7af5e54..916d73ec 100644 --- a/sifrovacka/urls.py +++ b/sifrovacka/urls.py @@ -1,7 +1,7 @@ from django.urls import path from seminar.utils import org_required, resitel_or_org_required -from .views import SifrovackaView, SifrovackaListView +from .views import SifrovackaView, SifrovackaListView, NapovedaView, NapovedaListView urlpatterns = [ path( @@ -14,4 +14,14 @@ urlpatterns = [ org_required(SifrovackaListView.as_view()), name='sifrovacka_odpovedi' ), + path( + 'napoveda/', + resitel_or_org_required(NapovedaView.as_view()), + name='sifrovacka_napoveda' + ), + path( + 'napovedy/', + org_required(NapovedaListView.as_view()), + name='sifrovacka_napovedy' + ), ] diff --git a/sifrovacka/views.py b/sifrovacka/views.py index 9c4af3ed..5537344b 100644 --- a/sifrovacka/views.py +++ b/sifrovacka/views.py @@ -2,8 +2,8 @@ from django.urls import reverse from django.views.generic import FormView, ListView from seminar.views import formularOKView -from .forms import SifrovackaForm -from .models import OdpovedUcastnika, SpravnaOdpoved +from .forms import SifrovackaForm, NapovedaForm +from .models import OdpovedUcastnika, SpravnaOdpoved, Napoveda, NapovezenoUcastnikovi from seminar.models.personalni import Resitel @@ -24,10 +24,31 @@ class SifrovackaView(FormView): instance.uspech = True instance.save() - + return formularOKView(self.request, f'

    {sifra.skryty_text}

    Odevzdat další.




    ') class SifrovackaListView(ListView): template_name = 'sifrovacka/odpovedi_list.html' model = OdpovedUcastnika + + +class NapovedaView(FormView): + template_name = 'sifrovacka/napoveda.html' + form_class = NapovedaForm + + def form_valid(self, form): + instance = form.save(commit=False) + resitel = Resitel.objects.get(osoba__user=self.request.user) + instance.resitel = resitel + + if NapovezenoUcastnikovi.objects.filter(resitel=resitel, sifra=instance.sifra).first() is None: + instance.save() + + napoveda = Napoveda.objects.filter(sifra=instance.sifra).first() + return formularOKView(self.request, f'

    Nápověda k šifře číslo {instance.sifra} je:

    {napoveda.text}

    Odevzdat řešení.




    ') + + +class NapovedaListView(ListView): + template_name = 'sifrovacka/napovedy_list.html' + model = NapovezenoUcastnikovi From 9a93f954906d1eeaccc2a447d0c6c73a1f7a2445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Sun, 21 Apr 2024 21:06:56 +0200 Subject: [PATCH 30/31] =?UTF-8?q?fix:=20N=C3=A1pov=C4=9Bdy=20v=20=C5=A1ifr?= =?UTF-8?q?ova=C4=8Dce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sifrovacka/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sifrovacka/forms.py b/sifrovacka/forms.py index 8a1e16d1..3ae75cc1 100644 --- a/sifrovacka/forms.py +++ b/sifrovacka/forms.py @@ -26,5 +26,5 @@ class NapovedaForm(ModelForm): def clean_sifra(self): sifra = self.cleaned_data.get('sifra') if Napoveda.objects.filter(sifra=sifra).count() == 0: - raise ValidationError("K tomuto číslu šifry nemáme nápovědu. Zkonstolujte si ho prosím.") + raise ValidationError("K tomuto číslu šifry nemáme nápovědu. Zkontrolujte si ho prosím.") return sifra From d09a08f53fc5c9c028ac4295f0908fe7e4a9441e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 22 Apr 2024 23:27:29 +0200 Subject: [PATCH 31/31] =?UTF-8?q?fix:=20P=C5=99eskakov=C3=A1n=C3=AD=20v=20?= =?UTF-8?q?=C5=A1ifrova=C4=8Dce=20(je=20tam=20faaaaakt=20hodn=C4=9B=20sn?= =?UTF-8?q?=C4=9Bhu)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sifrovacka/templates/sifrovacka/napoveda.html | 4 +- .../templates/sifrovacka/preskoceni.html | 54 +++++++++++++++++++ .../templates/sifrovacka/sifrovacka.html | 4 +- sifrovacka/urls.py | 7 ++- sifrovacka/views.py | 16 ++++++ 5 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 sifrovacka/templates/sifrovacka/preskoceni.html diff --git a/sifrovacka/templates/sifrovacka/napoveda.html b/sifrovacka/templates/sifrovacka/napoveda.html index 88944216..cce48ed8 100644 --- a/sifrovacka/templates/sifrovacka/napoveda.html +++ b/sifrovacka/templates/sifrovacka/napoveda.html @@ -43,6 +43,8 @@ - Nechceme nápovědu, známe řešení! +

    Nechceme nápovědu, známe řešení!

    + +

    Přeskoč šifru

    {% endblock content %} diff --git a/sifrovacka/templates/sifrovacka/preskoceni.html b/sifrovacka/templates/sifrovacka/preskoceni.html new file mode 100644 index 00000000..64e777ea --- /dev/null +++ b/sifrovacka/templates/sifrovacka/preskoceni.html @@ -0,0 +1,54 @@ +{% extends "base.html" %} + +{% block content %} + +
    + +

    {% block nadpis1a %}M&Mí šifrovačka{% endblock nadpis1a %}

    + +
    + +

    Přeskočit šifru:

    + +
    + + {{form.non_field_errors}} + {% for field in form %} + {% if field.id_for_label != "id_odpoved" %} + + + + + + + + + {% if field.errors %} + + + + {% endif %} + {% else %} + {{ field.as_hidden }} + {% endif %} + {% endfor %} +
    + + + + {{ field }} + {{ field.help_text|safe }} +
    {{ field.errors }}
    + + {% csrf_token %} + + +
    + +

    Nechceme přeskočit, známe řešení!

    + +

    Nechceme přeskakovat, ale nápověda by se šikla.

    + +{% endblock content %} diff --git a/sifrovacka/templates/sifrovacka/sifrovacka.html b/sifrovacka/templates/sifrovacka/sifrovacka.html index 74943406..1ce95454 100644 --- a/sifrovacka/templates/sifrovacka/sifrovacka.html +++ b/sifrovacka/templates/sifrovacka/sifrovacka.html @@ -43,6 +43,8 @@ - Získat nápovědu +

    Získat nápovědu

    + +

    Přeskoč šifru

    {% endblock content %} diff --git a/sifrovacka/urls.py b/sifrovacka/urls.py index 916d73ec..85f9c4cc 100644 --- a/sifrovacka/urls.py +++ b/sifrovacka/urls.py @@ -1,7 +1,7 @@ from django.urls import path from seminar.utils import org_required, resitel_or_org_required -from .views import SifrovackaView, SifrovackaListView, NapovedaView, NapovedaListView +from .views import SifrovackaView, SifrovackaListView, NapovedaView, NapovedaListView, PreskoceniView urlpatterns = [ path( @@ -24,4 +24,9 @@ urlpatterns = [ org_required(NapovedaListView.as_view()), name='sifrovacka_napovedy' ), + path( + 'preskoceni/', + resitel_or_org_required(PreskoceniView.as_view()), + name='sifrovacka_preskoceni' + ), ] diff --git a/sifrovacka/views.py b/sifrovacka/views.py index 5537344b..59f3deec 100644 --- a/sifrovacka/views.py +++ b/sifrovacka/views.py @@ -52,3 +52,19 @@ class NapovedaView(FormView): class NapovedaListView(ListView): template_name = 'sifrovacka/napovedy_list.html' model = NapovezenoUcastnikovi + + +class PreskoceniView(FormView): + template_name = 'sifrovacka/preskoceni.html' + form_class = SifrovackaForm + initial = {"odpoved": "=======PŘESKOČENO======="} + + def form_valid(self, form): + instance = form.save(commit=False) + instance.odpoved = "=======PŘESKOČENO=======" + resitel = Resitel.objects.get(osoba__user=self.request.user) + instance.resitel = resitel + instance.save() + sifra = SpravnaOdpoved.objects.filter(sifra=instance.sifra).first() # FIXME co když je více "správných" odpovědí? + + return formularOKView(self.request, f'

    {sifra.skryty_text}

    Zpět na odevzdávátko.




    ')