diff --git a/Makefile b/Makefile index 482aeaff..81546659 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,8 @@ install_web: venv_check pip install --upgrade setuptools # Instalace závislostí webu pip install -r requirements.txt --upgrade - # Po vygenerování testdat spusť ./manage.py loaddata sitetree_new.json, ať máš menu - # Pro synchronizaci flatpages spusť make sync_prod_flatpages + # Po vygenerování testdat spusť ./manage.py loaddata data/*, ať máš menu a další modely +:x install_venv: ${VENV} ${VENV_PATH} diff --git a/data/sitetree_new.json b/data/sitetree_new.json index 6fb2b7f4..ec6cd36c 100644 --- a/data/sitetree_new.json +++ b/data/sitetree_new.json @@ -1,816 +1,810 @@ [ - { - "model": "sitetree.tree", - "pk": 1, - "fields": { - "title": "Hlavní menu", - "alias": "main_menu" - } - }, - { - "model": "sitetree.treeitem", - "pk": 1, - "fields": { - "title": "Co je M&M", - "hint": "", - "url": "/co-je-MaM/uvod/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": null, - "sort_order": 1, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 2, - "fields": { - "title": "Jak řešit", - "hint": "", - "url": "/jak-resit/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": null, - "sort_order": 2, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 3, - "fields": { - "title": "Aktuální
ročník", - "hint": "", - "url": "seminar_aktualni_zadani", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": null, - "sort_order": 3, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 4, - "fields": { - "title": "Soustředění", - "hint": "", - "url": "/soustredeni/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": null, - "sort_order": 4, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 5, - "fields": { - "title": "Archiv", - "hint": "", - "url": "seminar_archiv_rocniky", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": null, - "sort_order": 5, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 6, - "fields": { - "title": "Přihlásit", - "hint": "", - "url": "login", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": true, - "access_restricted": false, - "access_perm_type": 1, - "parent": null, - "sort_order": 6, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 7, - "fields": { - "title": "Úvod", - "hint": "", - "url": "/co-je-MaM/uvod/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 1, - "sort_order": 7, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 8, - "fields": { - "title": "Organizátoři", - "hint": "", - "url": "organizatori", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 1, - "sort_order": 8, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 9, - "fields": { - "title": "FAQ", - "hint": "", - "url": "/co-je-MaM/FAQ/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 1, - "sort_order": 9, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 10, - "fields": { - "title": "Kontakt", - "hint": "", - "url": "/co-je-MaM/kontakt/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 1, - "sort_order": 10, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 11, - "fields": { - "title": "Témata", - "hint": "", - "url": "/jak-resit/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 2, - "sort_order": 11, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 12, - "fields": { - "title": "Jak psát příspěvek", - "hint": "", - "url": "/jak-resit/jak-psat-prispevek/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 2, - "sort_order": 12, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 13, - "fields": { - "title": "Odměny", - "hint": "", - "url": "/co-je-MaM/odmeny/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 2, - "sort_order": 13, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 16, - "fields": { - "title": "Výsledková listina", - "hint": "", - "url": "zadani/vysledkova-listina/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 3, - "sort_order": 33, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 17, - "fields": { - "title": "Články", - "hint": "", - "url": "clanky_resitel", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 3, - "sort_order": 34, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 18, - "fields": { - "title": "Úvod", - "hint": "", - "url": "/soustredeni/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 4, - "sort_order": 18, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 19, - "fields": { - "title": "Připravujeme", - "hint": "", - "url": "/soustredeni/pripravujeme/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 4, - "sort_order": 19, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 20, - "fields": { - "title": "Proběhlo", - "hint": "", - "url": "seminar_seznam_soustredeni", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 4, - "sort_order": 20, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 21, - "fields": { - "title": "Profil", - "hint": "", - "url": "profil", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": true, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": null, - "sort_order": 21, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 22, - "fields": { - "title": "Osobní údaje", - "hint": "", - "url": "seminar_resitel_edit", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 21, - "sort_order": 23, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 23, - "fields": { - "title": "Poslat řešení", - "hint": "", - "url": "seminar_nahraj_reseni", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 21, - "sort_order": 36, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 24, - "fields": { - "title": "Témata", - "hint": "", - "url": "seminar_temata", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 5, - "sort_order": 35, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 28, - "fields": { - "title": "HIDDEN", - "hint": "", - "url": "/korektury/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": true, - "access_perm_type": 1, - "parent": null, - "sort_order": 28, - "access_permissions": [ - 1 - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 30, - "fields": { - "title": "Aktuální", - "hint": "", - "url": "korektury_list", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 28, - "sort_order": 30, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 31, - "fields": { - "title": "Zastaralé", - "hint": "", - "url": "korektury_stare_list", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 28, - "sort_order": 31, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 32, - "fields": { - "title": "Nápověda", - "hint": "", - "url": "/korektury/help/", - "urlaspattern": false, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 28, - "sort_order": 32, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 33, - "fields": { - "title": "Aktuální číslo", - "hint": "", - "url": "seminar_aktualni_zadani", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 3, - "sort_order": 15, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 34, - "fields": { - "title": "Témata", - "hint": "", - "url": "seminar_temata", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 3, - "sort_order": 17, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 35, - "fields": { - "title": "Čísla", - "hint": "", - "url": "seminar_archiv_rocniky", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 5, - "sort_order": 24, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 36, - "fields": { - "title": "Úvod", - "hint": "", - "url": "profil", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": false, - "access_perm_type": 1, - "parent": 21, - "sort_order": 22, - "access_permissions": [ - - ] - } - }, - { - "model": "sitetree.treeitem", - "pk": 37, - "fields": { - "title": "Odevzdaná řešení", - "hint": "", - "url": "odevzdavatko_tabulka", - "urlaspattern": true, - "tree": 1, - "hidden": false, - "alias": null, - "description": "", - "inmenu": true, - "inbreadcrumbs": true, - "insitetree": true, - "access_loggedin": false, - "access_guest": false, - "access_restricted": true, - "access_perm_type": 1, - "parent": 21, - "sort_order": 37, - "access_permissions": [ - 1 - ] - } - } + { + "fields": { + "alias": "main_menu", + "title": "Hlavní menu" + }, + "model": "sitetree.tree", + "pk": 1 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": null, + "sort_order": 1, + "title": "Co je M&M", + "tree": 1, + "url": "/co-je-MaM/uvod/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 1 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": null, + "sort_order": 2, + "title": "Jak řešit", + "tree": 1, + "url": "/jak-resit/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 2 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": null, + "sort_order": 3, + "title": "Aktuální
ročník", + "tree": 1, + "url": "seminar_aktualni_zadani", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 3 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": null, + "sort_order": 4, + "title": "Soustředění", + "tree": 1, + "url": "/soustredeni/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 4 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": null, + "sort_order": 5, + "title": "Archiv", + "tree": 1, + "url": "seminar_archiv_rocniky", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 5 + }, + { + "fields": { + "access_guest": true, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": null, + "sort_order": 6, + "title": "Přihlásit", + "tree": 1, + "url": "login", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 6 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 1, + "sort_order": 7, + "title": "Úvod", + "tree": 1, + "url": "/co-je-MaM/uvod/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 7 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 1, + "sort_order": 8, + "title": "Organizátoři", + "tree": 1, + "url": "organizatori", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 8 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 1, + "sort_order": 9, + "title": "FAQ", + "tree": 1, + "url": "/co-je-MaM/FAQ/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 9 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 1, + "sort_order": 10, + "title": "Kontakt", + "tree": 1, + "url": "/co-je-MaM/kontakt/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 10 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 2, + "sort_order": 11, + "title": "Témata", + "tree": 1, + "url": "/jak-resit/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 11 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 2, + "sort_order": 12, + "title": "Jak psát příspěvek", + "tree": 1, + "url": "/jak-resit/jak-psat-prispevek/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 12 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 2, + "sort_order": 13, + "title": "Odměny", + "tree": 1, + "url": "/co-je-MaM/odmeny/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 13 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 3, + "sort_order": 33, + "title": "Výsledková listina", + "tree": 1, + "url": "zadani/vysledkova-listina/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 16 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 3, + "sort_order": 34, + "title": "Články", + "tree": 1, + "url": "clanky_resitel", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 17 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 4, + "sort_order": 18, + "title": "Úvod", + "tree": 1, + "url": "/soustredeni/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 18 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 4, + "sort_order": 19, + "title": "Připravujeme", + "tree": 1, + "url": "/soustredeni/pripravujeme/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 19 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 4, + "sort_order": 20, + "title": "Proběhlo", + "tree": 1, + "url": "seminar_seznam_soustredeni", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 20 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": true, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": null, + "sort_order": 21, + "title": "Profil", + "tree": 1, + "url": "profil", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 21 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 21, + "sort_order": 23, + "title": "Osobní údaje", + "tree": 1, + "url": "seminar_resitel_edit", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 22 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [ + 2 + ], + "access_restricted": true, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 21, + "sort_order": 36, + "title": "Poslat řešení", + "tree": 1, + "url": "seminar_nahraj_reseni", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 23 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 5, + "sort_order": 35, + "title": "Témata", + "tree": 1, + "url": "seminar_archiv_temata", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 24 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [ + 1 + ], + "access_restricted": true, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": null, + "sort_order": 28, + "title": "HIDDEN", + "tree": 1, + "url": "/korektury/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 28 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 28, + "sort_order": 30, + "title": "Aktuální", + "tree": 1, + "url": "korektury_list", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 30 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 28, + "sort_order": 31, + "title": "Zastaralé", + "tree": 1, + "url": "korektury_stare_list", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 31 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 28, + "sort_order": 32, + "title": "Nápověda", + "tree": 1, + "url": "/korektury/help/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 32 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 3, + "sort_order": 15, + "title": "Aktuální číslo", + "tree": 1, + "url": "seminar_aktualni_zadani", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 33 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 3, + "sort_order": 17, + "title": "Témata", + "tree": 1, + "url": "seminar_temata", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 34 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 5, + "sort_order": 24, + "title": "Čísla", + "tree": 1, + "url": "seminar_archiv_rocniky", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 35 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 21, + "sort_order": 22, + "title": "Úvod", + "tree": 1, + "url": "profil", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 36 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [ + 1 + ], + "access_restricted": true, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 21, + "sort_order": 37, + "title": "Odevzdaná řešení", + "tree": 1, + "url": "odevzdavatko_tabulka", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 37 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": true, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": false, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 21, + "sort_order": 38, + "title": "Odhlásit se", + "tree": 1, + "url": "/logout/", + "urlaspattern": false + }, + "model": "sitetree.treeitem", + "pk": 38 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [ + 1 + ], + "access_restricted": true, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 21, + "sort_order": 36, + "title": "Nahrát řešení", + "tree": 1, + "url": "seminar_vloz_reseni", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 39 + } ] diff --git a/fix_json.py b/fix_json.py new file mode 100755 index 00000000..411349f2 --- /dev/null +++ b/fix_json.py @@ -0,0 +1,12 @@ +#!/usr/bin/python3 + +import json +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("input", type=argparse.FileType('r', encoding='utf-8')) +parser.add_argument('output', type=argparse.FileType('w', encoding='utf-8')) +args = parser.parse_args() + +data = json.load(args.input) +json.dump(data, args.output, ensure_ascii=False, sort_keys=True, indent='\t') diff --git a/korektury/views.py b/korektury/views.py index aea3813a..47f62b6d 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -186,7 +186,7 @@ class KorekturyView(generic.TemplateView): if email: emails.discard(email) - if not settings.SEND_EMAIL_NOTIFICATIONS: + if not settings.POSLI_MAILOVOU_NOTIFIKACI: print("Poslal bych upozornění na tyto adresy: ", " ".join(emails)) return diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 7a2bf85b..95008c31 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -308,4 +308,4 @@ CISLO_IMG_DIR = os.path.join('cislo', 'img') # E-MAIL NOTIFICATIONS -SEND_EMAIL_NOTIFICATIONS = False +POSLI_MAILOVOU_NOTIFIKACI = False diff --git a/mamweb/settings_prod.py b/mamweb/settings_prod.py index 1c223842..0374d88b 100644 --- a/mamweb/settings_prod.py +++ b/mamweb/settings_prod.py @@ -66,4 +66,4 @@ LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/ # E-MAIL NOTIFICATIONS -SEND_EMAIL_NOTIFICATIONS = True +POSLI_MAILOVOU_NOTIFIKACI = True diff --git a/mamweb/static/images/header/beh.jpg b/mamweb/static/images/header/beh.jpg index 3f6bb160..d40cfccf 100644 Binary files a/mamweb/static/images/header/beh.jpg and b/mamweb/static/images/header/beh.jpg differ diff --git a/mamweb/templates/base.html b/mamweb/templates/base.html index 039cae3a..df7e50b8 100644 --- a/mamweb/templates/base.html +++ b/mamweb/templates/base.html @@ -31,6 +31,10 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> + {# Případné skripty widgetů formulářů #} + {% if form %} + {{form.media}} + {% endif %} {# script specifický pro stránku #} {% block script %}{% endblock %} diff --git a/seminar/admin.py b/seminar/admin.py index 222cafb4..21951ea4 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -1,11 +1,14 @@ from django.contrib import admin from django.contrib.auth.models import Permission +from django.db import models +from django.forms import widgets from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin, PolymorphicChildModelFilter from reversion.admin import VersionAdmin from django_reverse_admin import ReverseModelAdmin from solo.admin import SingletonModelAdmin + # Todo: reversion import seminar.models as m @@ -14,8 +17,6 @@ admin.site.register(m.Skola) admin.site.register(m.Prijemce) admin.site.register(m.Rocnik) admin.site.register(m.Cislo) -admin.site.register(m.Organizator) -admin.site.register(m.Soustredeni) @admin.register(m.Osoba) class OsobaAdmin(admin.ModelAdmin): @@ -42,7 +43,14 @@ class OsobaAdmin(admin.ModelAdmin): org.save() udelej_orgem.short_description = "Udělej vybraných osob organizátory" +@admin.register(m.Organizator) +class OrganizatorAdmin(admin.ModelAdmin): + search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'prezdivka'] +@admin.register(m.Resitel) +class ResitelAdmin(admin.ModelAdmin): + search_fields = ['jmeno', 'prijmeni', 'prezdivka'] + ordering = ('osoba__jmeno','osoba__prijmeni') @admin.register(m.Problem) class ProblemAdmin(PolymorphicParentModelAdmin): @@ -74,15 +82,55 @@ class KonferaAdmin(PolymorphicChildModelAdmin): base_model = m.Konfera show_in_index = True + class TextAdminInline(admin.TabularInline): model = m.Text + formfield_overrides = { + models.TextField: {'widget': widgets.TextInput} + } exclude = ['text_zkraceny_set','text_zkraceny'] + admin.site.register(m.Text) class ResitelInline(admin.TabularInline): model = m.Resitel extra = 1 -admin.site.register(m.Resitel) + +class SoustredeniUcastniciInline(admin.TabularInline): + model = m.Soustredeni_Ucastnici + extra = 1 + fields = ['resitel','poznamka'] + autocomplete_fields = ['resitel'] + ordering = ['resitel__osoba__jmeno', 'resitel__osoba__prijmeni'] + formfield_overrides = { + models.TextField: {'widget': widgets.TextInput} + } + + def get_queryset(self,request): + qs = super().get_queryset(request) + return qs.select_related('resitel','soustredeni') + +class SoustredeniOrganizatoriInline(admin.TabularInline): + model = m.Soustredeni.organizatori.through + extra = 1 + fields = ['organizator','poznamka'] + autocomplete_fields = ['organizator'] + ordering = ['organizator__osoba__jmeno','organizator__prijmeni'] + formfield_overrides = { + models.TextField: {'widget': widgets.TextInput} + } + + def get_queryset(self,request): + qs = super().get_queryset(request) + return qs.select_related('organizator', 'soustredeni') + + +@admin.register(m.Soustredeni) +class SoustredeniAdmin(admin.ModelAdmin): + model = m.Soustredeni + inline_type = 'tabular' + inlines = [SoustredeniUcastniciInline, SoustredeniOrganizatoriInline] + class PrilohaReseniInline(admin.TabularInline): model = m.PrilohaReseni @@ -92,6 +140,7 @@ admin.site.register(m.PrilohaReseni) class Reseni_ResiteleInline(admin.TabularInline): model = m.Reseni_Resitele + @admin.register(m.Reseni) class ReseniAdmin(ReverseModelAdmin): base_model = m.Reseni @@ -106,7 +155,6 @@ admin.site.register(m.Hodnoceni) admin.site.register(m.Pohadka) admin.site.register(m.Obrazek) - # Polymorfismus pro stromy # TODO: Inlines podle https://django-polymorphic.readthedocs.io/en/stable/admin.html diff --git a/seminar/forms.py b/seminar/forms.py index 0886f87d..71402a58 100644 --- a/seminar/forms.py +++ b/seminar/forms.py @@ -184,7 +184,7 @@ class ProfileEditForm(forms.Form): max_value=date.today().year+8, required=True) zasilat = forms.ChoiceField(label='Kam zasílat čísla a řešení',choices = Resitel.ZASILAT_CHOICES, required=True) - zasilat_cislo_emailem = forms.BooleanField(label='Chci dostávat email s upozorněním na vydání nového čísla', required=True) + zasilat_cislo_emailem = forms.BooleanField(label='Chci dostávat email s upozorněním na vydání nového čísla', required=False) spam = forms.BooleanField(label='Souhlasím se zasíláním materiálů od MFF UK', required=False) # def clean_username(self): diff --git a/seminar/models.py b/seminar/models.py index f3491089..797a215c 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -31,6 +31,8 @@ from unidecode import unidecode # Používám pro získání ID odkazu (ještě from polymorphic.models import PolymorphicModel +from django.core.mail import EmailMessage +from seminar.utils import aktivniResitele class SeminarModelBase(models.Model): @@ -624,9 +626,43 @@ class Cislo(SeminarModelBase): return None return c + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.__original_verejne = self.verejne_db + + def posli_cislo_mailem(self): + # parametry e-mailu + odkaz = self.get_absolute_url() + + poslat_z_mailu = 'zadani@mam.mff.cuni.cz' + predmet = 'Vyšlo číslo {}'.format(self.kod()) + text_mailu = 'Ahoj,\n' \ + 'na adrese {} najdete nejnovější číslo.\n' \ + 'Vaše M&M\n'.format(odkaz) + + # Prijemci e-mailu + emaily = map(lambda r: r.osoba.email, filter(lambda r: r.zasilat_cislo_emailem, aktivniResitele(self))) + + if not settings.POSLI_MAILOVOU_NOTIFIKACI: + print("Poslal bych upozornění na tyto adresy: ", " ".join(emaily)) + return + + email = EmailMessage( + subject=predmet, + body=text_mailu, + from_email=poslat_z_mailu, + bcc=list(emaily) + #bcc = příjemci skryté kopie + ) + + email.send() + def save(self, *args, **kwargs): super().save(*args, **kwargs) self.vygeneruj_nahled() + # Při zveřejnění pošle mail + if self.verejne_db and not self.__original_verejne: + self.posli_cislo_mailem() # *Node.save() aktualizuje název *Nodu. try: self.cislonode.save() diff --git a/seminar/static/images/no-picture.png b/seminar/static/images/no-picture.png new file mode 100644 index 00000000..9256f628 Binary files /dev/null and b/seminar/static/images/no-picture.png differ diff --git a/seminar/templates/seminar/archiv/rocnik.html b/seminar/templates/seminar/archiv/rocnik.html index 1c039063..bf251ab3 100644 --- a/seminar/templates/seminar/archiv/rocnik.html +++ b/seminar/templates/seminar/archiv/rocnik.html @@ -32,7 +32,7 @@ {% if c.titulka_nahled %} {{ c.kod }} {% else %} - no image + {% load static %} no-picture {% endif %} diff --git a/seminar/templates/seminar/orgorozcestnik.html b/seminar/templates/seminar/orgorozcestnik.html index 73268812..5f89d36d 100644 --- a/seminar/templates/seminar/orgorozcestnik.html +++ b/seminar/templates/seminar/orgorozcestnik.html @@ -58,6 +58,7 @@

Soustředění