diff --git a/.gitignore b/.gitignore index d3a2a533..f70ed3c4 100644 --- a/.gitignore +++ b/.gitignore @@ -31,9 +31,15 @@ TODO # reversion kvůli historii objektů v reversion **/reversion +# dokumentace +docs/_build +docs/modules + +# logy týracího skriptu (./checklinks.sh) +/wget.log.* + # pro lidi, co programují v nástrojích od JetBrains .idea -# dokumentace -docs/_build -docs/modules \ No newline at end of file +# Mac users +.DS_Store diff --git a/_git_hooks/README.md b/_git_hooks/README.md deleted file mode 100644 index e74e5c53..00000000 --- a/_git_hooks/README.md +++ /dev/null @@ -1,16 +0,0 @@ -git hooks -========= - -Kontrola stylu pythoních zdrojáků pomocí flake8. Kontrolujeme jen změny, -abychom nenutili lidi dělat nesouvisející úpravy, které by rozbíjely historii -(git blame). - -pre-commit ----------- -* kontrola změn před commitnutím -* instalace: lokálně zkopírovat do .git/hooks (musí být spustitelný) - -update ------- -* kontrola změn přicházejících s pushem -* instalace: na atreyi zkopírovat do /akce/MaM/MaMweb/mamweb.git/hooks diff --git a/_git_hooks/pre-commit b/_git_hooks/pre-commit deleted file mode 100755 index f78840d4..00000000 --- a/_git_hooks/pre-commit +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# Git hook script to verify what is about to be committed. -# Checks that the changes don't introduce new flake8 errors. - -TMPDIFF=`tempfile` -FLAKE8="`git rev-parse --show-toplevel`/bin/flake8" - -status=0 - -# select only changed python files which are not migrations -changed=`git diff --cached --name-only | grep 'py$' | grep -v 'migrations/[0-9]'` -if [ -z $changed ] ; then - # Nothing to check. Note the exit is necessary -- we would not pass any - # paths to git diff below and it would output the diff unfiltered. - exit 0 -fi - -git diff --unified=1 --cached HEAD -- $changed > $TMPDIFF - -# only do the check when there are some changes to be commited -# otherwise flake8 would hang waiting for input -if [ -s $TMPDIFF ] ; then - cat $TMPDIFF | $FLAKE8 --diff - status=$? -fi - -rm -f $TMPDIFF - -exit $status diff --git a/_git_hooks/update b/_git_hooks/update deleted file mode 100755 index c700a1b1..00000000 --- a/_git_hooks/update +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -# git update hook to check that pushed changes don't introduce new flake8 -# errors - -# --- Command line -refname="$1" -oldrev="$2" -newrev="$3" - -# --- Safety check -if [ -z "$GIT_DIR" ]; then - echo "Don't run this script from the command line." >&2 - echo " (if you want, you could supply GIT_DIR then run" >&2 - echo " $0 )" >&2 - exit 1 -fi - -if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then - echo "usage: $0 " >&2 - exit 1 -fi - - -TMPDIR=`mktemp -d` -TMPDIFF=`tempfile` - -[ $refname != "refs/heads/master" -a $refname != "refs/heads/stable" ] && exit 0 - -# select only changed python files which are not migrations -changed=`git diff --name-only $oldrev $newrev | grep 'py$' | grep -v 'migrations/[0-9]'` -if [ -z $changed ] ; then - # Nothing to check. Note the exit is necessary -- we would not pass any - # paths to git diff below and it would output the diff unfiltered. - exit 0 -fi - -git diff --unified=1 $oldrev $newrev -- $changed >${TMPDIFF} - -# there is no working tree in bare git repository, so we recreate it for flake8 -git archive $newrev | tar -x -C ${TMPDIR} - -cd ${TMPDIR} -# report only errors on lines in diff -# (if threre was flake8 installed on atrey, we could just call flake8) -/akce/MaM/WWW/mamweb-test/bin/flake8 --diff <${TMPDIFF} -status=$? -if [ $status != 0 ] ; then - echo - echo -n "Změny, které se snažíte pushnout, obsahují kód v pythonu " - echo -n "nevyhovující flake8 (viz výše). Opravte je a zkuste to znovu. " - echo -n "Nezapomeňte, že můžete editovat historii (git commit --amend, " - echo -n "git rebase -i). Pokud byste chybu příště raději odhalili už při " - echo "commitu, zkopírujte si pre-commit hook z _git_hooks do .git/hooks." - echo -fi - -rm -rf ${TMPDIR} -rm -f ${TMPDIFF} - -exit $status diff --git a/aesop/apps.py b/aesop/apps.py index 4e8b4787..3974f084 100644 --- a/aesop/apps.py +++ b/aesop/apps.py @@ -1,8 +1,5 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig - class AesopConfig(AppConfig): name = 'aesop' + verbose_name = 'Export do AESOPa' diff --git a/aesop/urls.py b/aesop/urls.py index 946a873b..f39a0ba8 100644 --- a/aesop/urls.py +++ b/aesop/urls.py @@ -1,10 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- ``aesop-export/mam-rocnik-.csv`` (seminar_export_rocnik) :class:`~aesop.views.ExportRocnikView` -- ``aesop-export/mam-sous-.csv`` (seminar_export_sous) :class:`~aesop.views.ExportSousView` -- ``aesop-export/index.csv`` (seminar_export_index) :class:`~aesop.views.ExportIndexView` -""" from django.urls import path from aesop import views diff --git a/aesop/views.py b/aesop/views.py index e4b3364b..5fd49cbc 100644 --- a/aesop/views.py +++ b/aesop/views.py @@ -1,8 +1,3 @@ -""" -Soubor sloužící k deklaraci jednotlivých „views“ (nejčastěji funkce beroucí request -a vracející :func:`django.shortcuts.render` respektive nějakou response, nebo -třídy většinou rozšiřující nějakou třídu z :mod:`django.views.generic`) -""" import django from django.shortcuts import get_object_or_404 from django.http import HttpResponse diff --git a/api/apps.py b/api/apps.py index 6a2bdbc4..3800f6a9 100644 --- a/api/apps.py +++ b/api/apps.py @@ -1,8 +1,6 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig class ApiConfig(AppConfig): name = 'api' + verbose_name = 'Různá webová API' diff --git a/api/urls.py b/api/urls.py index a3b5a4aa..9ff38424 100644 --- a/api/urls.py +++ b/api/urls.py @@ -1,15 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- ``api/expor/skoly/`` (export_skoly) :func:`~api.views.exports.exportSkolView` -- ``api/autocomplete/skola/`` (autocomplete_skola) :class:`~api.views.autocomplete.SkolaAutocomplete` -- ``api/autocomplete/resitel/`` (autocomplete_resitel) :class:`~api.views.autocomplete.ResitelAutocomplete` -- ``api/autocomplete/problem/odevzdatelny`` (autocomplete_problem_odevzdatelny) :class:`~api.views.autocomplete.OdevzdatelnyProblemAutocomplete` - -Na autocomplete v3 čeká: - -- ``autocomplete/organizatori/`` (seminar_autocomplete_organizator) :class:`~api.views.autocomplete.OrganizatorAutocomplete` -""" from django.urls import path from . import views from seminar.utils import org_required diff --git a/api/views/__init__.py b/api/views/__init__.py index 13ce91ba..fc00554e 100644 --- a/api/views/__init__.py +++ b/api/views/__init__.py @@ -1,7 +1,2 @@ -""" -Soubory sloužící k deklaraci jednotlivých „views“ (nejčastěji funkce beroucí request -a vracející :func:`django.shortcuts.render` respektive nějakou response, nebo -třídy většinou rozšiřující nějakou třídu z :mod:`django.views.generic`) -""" from .autocomplete import * from .exports import * diff --git a/data/sitetree.json b/data/sitetree.json index 29403e5a..933c628a 100644 --- a/data/sitetree.json +++ b/data/sitetree.json @@ -1079,5 +1079,29 @@ }, "model": "sitetree.treeitem", "pk": 53 + }, + { + "fields": { + "access_guest": false, + "access_loggedin": false, + "access_perm_type": 1, + "access_permissions": [], + "access_restricted": true, + "alias": null, + "description": "", + "hidden": false, + "hint": "", + "inbreadcrumbs": true, + "inmenu": true, + "insitetree": true, + "parent": 20, + "sort_order": 54, + "title": "Export do abstraktů sousu {{ soustredeni.id }}", + "tree": 1, + "url": "seminar_soustredeni_abstrakty soustredeni.id", + "urlaspattern": true + }, + "model": "sitetree.treeitem", + "pk": 54 } ] diff --git a/deploy_v2/admin_org_prava.json b/deploy_v2/admin_org_prava.json index 9caa6eb2..370aec4f 100644 --- a/deploy_v2/admin_org_prava.json +++ b/deploy_v2/admin_org_prava.json @@ -331,22 +331,22 @@ }, { "codename": "add_novinky", - "ct_app_label": "seminar", + "ct_app_label": "novinky", "ct_model": "novinky" }, { "codename": "change_novinky", - "ct_app_label": "seminar", + "ct_app_label": "novinky", "ct_model": "novinky" }, { "codename": "delete_novinky", - "ct_app_label": "seminar", + "ct_app_label": "novinky", "ct_model": "novinky" }, { "codename": "view_novinky", - "ct_app_label": "seminar", + "ct_app_label": "novinky", "ct_model": "novinky" }, { diff --git a/docs/dalsi_soubory.rst b/docs/dalsi_soubory.rst index 627a59d7..2b1a362b 100644 --- a/docs/dalsi_soubory.rst +++ b/docs/dalsi_soubory.rst @@ -9,12 +9,6 @@ static ------ Složka, kam django nakopíruje všechno ze složek static a pak na to z templatů / kódu jde ukazovat pomocí ``static``. -_git_hooks ----------- -Hooky do gitu pro kontrolu Pythoního stylu. Především ``flake8``. - -Zbylo tu z minulosti mamwebu. - data ---- Obsahuje data, která patří do databáze, ale jsou přímo součástí webu jako diff --git a/ilustrace_odmeny/jak_nahrat_do_flatpage b/docs/jak_nahrat_do_flatpage similarity index 82% rename from ilustrace_odmeny/jak_nahrat_do_flatpage rename to docs/jak_nahrat_do_flatpage index 7e88641d..2c4b208c 100644 --- a/ilustrace_odmeny/jak_nahrat_do_flatpage +++ b/docs/jak_nahrat_do_flatpage @@ -1,3 +1,4 @@ +FIXME přepsat do rst, přidat i další věci a případně přesunout na wiki Přidání obrázků do odměn: admin -> flatpage odměn -> ikona přidat obrázek záložka odeslat, vybrat obrázek, odeslat diff --git a/galerie/TODO b/galerie/TODO deleted file mode 100644 index c8afd3c4..00000000 --- a/galerie/TODO +++ /dev/null @@ -1,25 +0,0 @@ -======== -| TODO | -|======| - -Aktualni -* co s titulni fotkou -* do CSS - * nahledy - * nastylovat tabulku s nahledy - * komentare uz na nahledy? - * detail - * nahledy pred a po - * opravit prechodove sipky - * vyrobit prechodove sipky ve M&M-stylu - -Dlouhodobe -* sipky na prechazeni mezi fotkami -* hromadne PRIDANI fotek do jiz existujici galerie - -Fylozoficke -* zvolit velikosti velke a male fotky -* je potreba i jine razeni nez automaticky podle casu nebo staci podgalerie? - * napr. dve hry na dvou ruznych mistech ve stejny cas - * fotky od ucastniku ze hry (skupinky se pohybuji ve stejny cas, ale maji sled fotek) -- nestaci to pripadne vrazit do podgalerii? - diff --git a/galerie/admin.py b/galerie/admin.py index 54b0751e..2b270163 100644 --- a/galerie/admin.py +++ b/galerie/admin.py @@ -1,5 +1,3 @@ -#coding: utf-8 - from galerie.models import Obrazek, Galerie from django.contrib import admin from django.http import HttpResponseRedirect diff --git a/galerie/autocomplete_light_registry.py.old b/galerie/autocomplete_light_registry.py.old deleted file mode 100644 index dcedfc1a..00000000 --- a/galerie/autocomplete_light_registry.py.old +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -from autocomplete_light import shortcuts as autocomplete_light - -from .models import Obrazek, Galerie -from .views import cesta_od_korene - - -class ObrazekAutocomplete(autocomplete_light.AutocompleteModelBase): - - model = Obrazek - search_fields = ['nazev', 'popis'] - split_words = True - limit_choices = 15 - attrs = { - # This will set the input placeholder attribute: - 'placeholder': u'Obrázek', - # This will set the yourlabs.Autocomplete.minimumCharacters - # options, the naming conversion is handled by jQuery - 'data-autocomplete-minimum-characters': 1, - } - - choice_html_format = ''' - - - {} - {} - - - ''' - - def choice_label(self, obrazek): - cesta = "/".join(g.nazev for g in cesta_od_korene(obrazek.galerie)) - popis = "{}
".format(obrazek.popis) if obrazek.popis else "" - return '{}
{}{}'.format(obrazek.nazev, popis, cesta) - - def choice_html(self, obrazek): - """Vrátí kus html i s obrázkem, které se pak ukazuje v nabídce""" - return self.choice_html_format.format(self.choice_value(obrazek), - obrazek.obrazek_maly_tag(), self.choice_label(obrazek)) - - widget_attrs={ - 'data-widget-maximum-values': 15, - 'class': 'modern-style', - } - -autocomplete_light.register(ObrazekAutocomplete) diff --git a/galerie/forms.py b/galerie/forms.py index e6666884..e27b53fb 100644 --- a/galerie/forms.py +++ b/galerie/forms.py @@ -1,5 +1,3 @@ -#coding: utf-8 - from django import forms from seminar.models import Soustredeni diff --git a/galerie/migrations/0001_initial.py b/galerie/migrations/0001_initial.py index 21701185..9e65fe22 100644 --- a/galerie/migrations/0001_initial.py +++ b/galerie/migrations/0001_initial.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/galerie/migrations/0002_auto_20151013_1145.py b/galerie/migrations/0002_auto_20151013_1145.py index ea241267..5ec830a6 100644 --- a/galerie/migrations/0002_auto_20151013_1145.py +++ b/galerie/migrations/0002_auto_20151013_1145.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/galerie/migrations/0003_add_galerie_poradi.py b/galerie/migrations/0003_add_galerie_poradi.py index d9b32f48..a8abf94d 100644 --- a/galerie/migrations/0003_add_galerie_poradi.py +++ b/galerie/migrations/0003_add_galerie_poradi.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/galerie/migrations/0004_nepovinna_galerie_u_obrazku.py b/galerie/migrations/0004_nepovinna_galerie_u_obrazku.py index 53e17922..a2b593b1 100644 --- a/galerie/migrations/0004_nepovinna_galerie_u_obrazku.py +++ b/galerie/migrations/0004_nepovinna_galerie_u_obrazku.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/galerie/migrations/0005_obrazek_ordering_datum.py b/galerie/migrations/0005_obrazek_ordering_datum.py index 988e0fd4..cc6f2948 100644 --- a/galerie/migrations/0005_obrazek_ordering_datum.py +++ b/galerie/migrations/0005_obrazek_ordering_datum.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/galerie/migrations/0006_django_imagekit.py b/galerie/migrations/0006_django_imagekit.py index 6b90b791..b38caae3 100644 --- a/galerie/migrations/0006_django_imagekit.py +++ b/galerie/migrations/0006_django_imagekit.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/galerie/migrations/0007_obrazek_odstranen_datum.py b/galerie/migrations/0007_obrazek_odstranen_datum.py index 94c3596b..9ee8ac46 100644 --- a/galerie/migrations/0007_obrazek_odstranen_datum.py +++ b/galerie/migrations/0007_obrazek_odstranen_datum.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/galerie/migrations/0008_auto_20190430_2340.py b/galerie/migrations/0008_auto_20190430_2340.py index 140d554a..df70a161 100644 --- a/galerie/migrations/0008_auto_20190430_2340.py +++ b/galerie/migrations/0008_auto_20190430_2340.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-04-30 21:40 from __future__ import unicode_literals diff --git a/galerie/migrations/0009_auto_20190610_2358.py b/galerie/migrations/0009_auto_20190610_2358.py index 0228a8a7..513ee1de 100644 --- a/galerie/migrations/0009_auto_20190610_2358.py +++ b/galerie/migrations/0009_auto_20190610_2358.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.21 on 2019-06-10 21:58 from __future__ import unicode_literals diff --git a/galerie/models.py b/galerie/models.py index 96225101..074b0d26 100644 --- a/galerie/models.py +++ b/galerie/models.py @@ -1,5 +1,3 @@ -# coding: utf-8 - from django.db import models #from django.db.models import Q from imagekit.models import ImageSpecField diff --git a/galerie/urls.py b/galerie/urls.py index 2e311cd8..32824248 100644 --- a/galerie/urls.py +++ b/galerie/urls.py @@ -1,12 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- ``/`` :func:`~galerie.views.nahled` -- ``//`` :func:`~galerie.views.detail` -- ``/new/`` :func:`~galerie.views.new_galerie` -- ``/plus//`` :func:`~galerie.views.plus_galerie` -- ``/minus//`` :func:`~galerie.views.minus_galerie` -""" from django.urls import path from seminar.utils import org_required from . import views diff --git a/galerie/views.py b/galerie/views.py index f0d9b53b..872bb46e 100644 --- a/galerie/views.py +++ b/galerie/views.py @@ -1,5 +1,3 @@ -# coding: utf-8 - import random from django.http import HttpResponse, Http404 diff --git a/header_fotky/admin.py b/header_fotky/admin.py index b939541b..cfcb4d48 100644 --- a/header_fotky/admin.py +++ b/header_fotky/admin.py @@ -1,14 +1,3 @@ -""" -Soubor sloužící k definici toho, co bude v adminu. Většinou pouhým zavoláním -funkce :func:`django.contrib.admin.site.register`, v případě, že chceme něco -upravit, tak jako třída rozšiřující :class:`django.contrib.admin.ModelAdmin` -s dekorátorem :func:`django.contrib.admin.register`. - -Zde se definuje admin pro: - -- :class:`~header_fotky.models.FotkaHeader` -- :class:`~header_fotky.models.FotkaUrlVazba` -""" from django.contrib import admin from django.contrib.admin import ModelAdmin import header_fotky.models as m @@ -22,4 +11,4 @@ class FotkaPozadiAdmin(ModelAdmin): readonly_fields = ['cas'] admin.site.register(m.FotkaHeader, FotkaPozadiAdmin) -admin.site.register(m.FotkaUrlVazba) \ No newline at end of file +admin.site.register(m.FotkaUrlVazba) diff --git a/header_fotky/apps.py b/header_fotky/apps.py index 13f93ed4..6f9e5aee 100644 --- a/header_fotky/apps.py +++ b/header_fotky/apps.py @@ -1,8 +1,6 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig class HeaderFotkyConfig(AppConfig): name = 'header_fotky' + verbose_name = 'Fotky v záhlaví' diff --git a/header_fotky/models.py b/header_fotky/models.py index 750cc575..e48a743a 100644 --- a/header_fotky/models.py +++ b/header_fotky/models.py @@ -1,17 +1,3 @@ -""" -Tento soubor slouží k definici databázového modelu. - -Třídy rozšiřují většinou :class:`django.db.models.Model` a jejich atributy jsou -většinou sloupce v databázi (tj. nastaví se na hodnotu něčeho z :mod:`django.db.models`). -Na výběr jsou: - - - :class:`django.db.models.TextField` - - :class:`django.db.models.ForeignKey` - - :class:`django.db.models.DateField` - - :class:`django.db.models.DateTimeField` - - :class:`django.db.models.ImageField` - - :class:`django.db.models.CharField` -""" from django.core.exceptions import ValidationError from django.db import models from django.utils import timezone diff --git a/korektury/TODO b/korektury/TODO deleted file mode 100644 index df1b937a..00000000 --- a/korektury/TODO +++ /dev/null @@ -1,11 +0,0 @@ -- korektura potrebuje reakci -+ komentáře fixně na username - - používat skutečné jméno? -- vyžádat pozornost autora obsahu -- zvednout upload limit na 5MB -- sbalit a rozbalit korekturu -- nahrávání jiných věcí než PDF - kontrolovat? -- stylování -- seznam PDF - co zobrazovat? - - diff --git a/korektury/admin.py b/korektury/admin.py index 5f92c542..a04026de 100644 --- a/korektury/admin.py +++ b/korektury/admin.py @@ -1,13 +1,3 @@ -""" -Soubor sloužící k definici toho, co bude v adminu. Většinou pouhým zavoláním -funkce :func:`django.contrib.admin.site.register`, v případě, že chceme něco -upravit, tak jako třída rozšiřující :class:`django.contrib.admin.ModelAdmin` -s dekorátorem :func:`django.contrib.admin.register`. - -Zde se definuje admin pro: - -- :class:`korektury.models.KorekturovanePDF` -""" from django.contrib import admin from reversion.admin import VersionAdmin from korektury.models import KorekturovanePDF @@ -15,7 +5,6 @@ from korektury.models import KorekturovanePDF from django.core.mail import EmailMessage from django.urls import reverse -# Register your models here. class KorekturovanePDFAdmin(VersionAdmin): """ nastaví čas vložení (:attr:`~koretkury.models.KorekturovanePDF.cas`) a počet diff --git a/korektury/forms.py b/korektury/forms.py index 2fd439a6..22c82818 100644 --- a/korektury/forms.py +++ b/korektury/forms.py @@ -1,13 +1,3 @@ -""" -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 import forms class OpravaForm(forms.Form): diff --git a/korektury/migrations/0001_initial.py b/korektury/migrations/0001_initial.py index e9a89d18..37c2d18e 100644 --- a/korektury/migrations/0001_initial.py +++ b/korektury/migrations/0001_initial.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/korektury/migrations/0002_auto_20151202_2351.py b/korektury/migrations/0002_auto_20151202_2351.py index 2e7a8032..ed17b81c 100644 --- a/korektury/migrations/0002_auto_20151202_2351.py +++ b/korektury/migrations/0002_auto_20151202_2351.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/korektury/migrations/0003_auto_20151204_1855.py b/korektury/migrations/0003_auto_20151204_1855.py index 8f8cb70b..f08d8ece 100644 --- a/korektury/migrations/0003_auto_20151204_1855.py +++ b/korektury/migrations/0003_auto_20151204_1855.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/korektury/migrations/0004_auto_20151204_2240.py b/korektury/migrations/0004_auto_20151204_2240.py index ed47ccaf..18413ce0 100644 --- a/korektury/migrations/0004_auto_20151204_2240.py +++ b/korektury/migrations/0004_auto_20151204_2240.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/korektury/migrations/0005_auto_20151204_2244.py b/korektury/migrations/0005_auto_20151204_2244.py index 52ebdfb6..7047a49c 100644 --- a/korektury/migrations/0005_auto_20151204_2244.py +++ b/korektury/migrations/0005_auto_20151204_2244.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/korektury/migrations/0006_oprava_pdf.py b/korektury/migrations/0006_oprava_pdf.py index e8f81884..988388b2 100644 --- a/korektury/migrations/0006_oprava_pdf.py +++ b/korektury/migrations/0006_oprava_pdf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/korektury/migrations/0007_auto_20151225_1237.py b/korektury/migrations/0007_auto_20151225_1237.py index 805e3510..6f6436d5 100644 --- a/korektury/migrations/0007_auto_20151225_1237.py +++ b/korektury/migrations/0007_auto_20151225_1237.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/korektury/migrations/0008_auto_20151229_1556.py b/korektury/migrations/0008_auto_20151229_1556.py index 50e28379..253fe64d 100644 --- a/korektury/migrations/0008_auto_20151229_1556.py +++ b/korektury/migrations/0008_auto_20151229_1556.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/korektury/migrations/0009_trizeni_korektur_v_seznamu.py b/korektury/migrations/0009_trizeni_korektur_v_seznamu.py index c4099dce..8fde3a28 100644 --- a/korektury/migrations/0009_trizeni_korektur_v_seznamu.py +++ b/korektury/migrations/0009_trizeni_korektur_v_seznamu.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py b/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py index 6b318cab..445496ee 100644 --- a/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py +++ b/korektury/migrations/0010_Pridani_odkazu_na_organizatora.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/korektury/migrations/0011_prevod_autora_z_charField_na_Organizator.py b/korektury/migrations/0011_prevod_autora_z_charField_na_Organizator.py index 53082df9..30d40ef5 100644 --- a/korektury/migrations/0011_prevod_autora_z_charField_na_Organizator.py +++ b/korektury/migrations/0011_prevod_autora_z_charField_na_Organizator.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/korektury/migrations/0012_delete_autor.py b/korektury/migrations/0012_delete_autor.py index 4f41a955..ad542e18 100644 --- a/korektury/migrations/0012_delete_autor.py +++ b/korektury/migrations/0012_delete_autor.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/korektury/migrations/0013_rename_autor_org.py b/korektury/migrations/0013_rename_autor_org.py index db0d3151..99d1b3f4 100644 --- a/korektury/migrations/0013_rename_autor_org.py +++ b/korektury/migrations/0013_rename_autor_org.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/korektury/migrations/0014_add_org_to_pdf.py b/korektury/migrations/0014_add_org_to_pdf.py index afd939ba..d497ea16 100644 --- a/korektury/migrations/0014_add_org_to_pdf.py +++ b/korektury/migrations/0014_add_org_to_pdf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/korektury/migrations/0015_auto_20161004_2005.py b/korektury/migrations/0015_auto_20161004_2005.py index 36be10df..d4659ffc 100644 --- a/korektury/migrations/0015_auto_20161004_2005.py +++ b/korektury/migrations/0015_auto_20161004_2005.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/korektury/migrations/0016_auto_20190430_2340.py b/korektury/migrations/0016_auto_20190430_2340.py index f14bce2b..7c264485 100644 --- a/korektury/migrations/0016_auto_20190430_2340.py +++ b/korektury/migrations/0016_auto_20190430_2340.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-04-30 21:40 from __future__ import unicode_literals diff --git a/korektury/migrations/0017_auto_20190610_2358.py b/korektury/migrations/0017_auto_20190610_2358.py index 111f2f8f..a135a020 100644 --- a/korektury/migrations/0017_auto_20190610_2358.py +++ b/korektury/migrations/0017_auto_20190610_2358.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.21 on 2019-06-10 21:58 from __future__ import unicode_literals diff --git a/korektury/models.py b/korektury/models.py index ca1bb877..153c4f3c 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -1,17 +1,3 @@ -""" -Tento soubor slouží k definici databázového modelu. - -Třídy rozšiřují většinou :class:`django.db.models.Model` a jejich atributy jsou -většinou sloupce v databázi (tj. nastaví se na hodnotu něčeho z :mod:`django.db.models`). -Na výběr jsou: - - - :class:`django.db.models.TextField` - - :class:`django.db.models.ForeignKey` - - :class:`django.db.models.DateField` - - :class:`django.db.models.DateTimeField` - - :class:`django.db.models.ImageField` - - :class:`django.db.models.CharField` -""" import os from django.db import models from django.utils import timezone diff --git a/korektury/tests.py b/korektury/tests.py deleted file mode 100644 index 7ce503c2..00000000 --- a/korektury/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/korektury/urls.py b/korektury/urls.py index 96eb4dd4..dcd1d965 100644 --- a/korektury/urls.py +++ b/korektury/urls.py @@ -1,11 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- ``korektury/`` (korektury_list) :class:`~korektury.views.KorekturySeskupeneListView` -- ``korektury/neseskupene/`` (korektury_neseskupene_list) :class:`~korektury.views.KorekturyAktualniListView` -- ``korektury/zastarale/`` (korektury_stare_list) :class:`~korektury.views.KorekturyZastaraleListView` -- ``korektury//`` (korektury) :class:`~korektury.views.KorekturyView` -""" from django.urls import path from seminar.utils import org_required from . import views diff --git a/korektury/views.py b/korektury/views.py index 1bdfaa92..ee6f2841 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -1,8 +1,3 @@ -""" -Soubor sloužící k deklaraci jednotlivých „views“ (nejčastěji funkce beroucí request -a vracející :func:`django.shortcuts.render` respektive nějakou response, nebo -třídy většinou rozšiřující nějakou třídu z :mod:`django.views.generic`) -""" from django.shortcuts import get_object_or_404, render from django.views import generic from django.conf import settings @@ -199,13 +194,6 @@ class KorekturyView(generic.TemplateView): if email: emails.discard(email) - if not settings.POSLI_MAILOVOU_NOTIFIKACI: - print("Poslal bych upozornění na tyto adresy: ", " ".join(emails)) - print("---- Upozornění:") - print(text) - print("---- Konec upozornění") - return - EmailMessage( subject=subject, body=text, diff --git a/make/init_local b/make/init_local index 1b2f7c1e..76448a3c 100755 --- a/make/init_local +++ b/make/init_local @@ -7,5 +7,5 @@ make/install_web ensure_venv ./manage.py testdata ./manage.py loaddata data/* -make/sync_prod_flatpages +#make/sync_prod_flatpages ./manage.py load_org_permissions deploy_v2/admin_org_prava.json diff --git a/mamweb/admin.py b/mamweb/admin.py index 5d0351df..04d564cc 100644 --- a/mamweb/admin.py +++ b/mamweb/admin.py @@ -42,8 +42,18 @@ def get_app_list(self, request, app_label=None): """ app_dict = self._build_app_dict(request, label=app_label) - # Sort the apps alphabetically. - app_list = sorted(app_dict.values(), key=lambda x: locale.strxfrm('!') if (x['name'] == "Seminar") else locale.strxfrm(x['name'].lower())) + aplikace_nahore = [ + 'seminar', + 'personalni', + 'novinky', + 'korektury', + 'various', + 'prednasky', + 'soustredeni', + ] + # Odhlášený admin má prázdný app_dict :-/ + app_list = [app_dict[label] for label in aplikace_nahore if label in app_dict] + [app_dict[label] for label in app_dict if label not in aplikace_nahore] + # Sort the models alphabetically within each app. for app in app_list: diff --git a/mamweb/middleware.py b/mamweb/middleware.py deleted file mode 100644 index 7109423e..00000000 --- a/mamweb/middleware.py +++ /dev/null @@ -1,88 +0,0 @@ -from datetime import datetime, date - -from django.conf import settings -from django.http import HttpResponse, HttpResponseRedirect - - - -class LoggedInHintCookieMiddleware(object): - """Middleware to securely help with 'logged-in' detection for dual HTTP/HTTPS sites. - - On insecure requests: Checks for a (non-secure) cookie settings.LOGGED_IN_HINT_COOKIE_NAME - and if present, redirects to HTTPS (same adress). - Note this usually breaks non-GET (POST) requests. - - On secure requests: Updates cookie settings.LOGGED_IN_HINT_COOKIE_NAME to reflect - whether an user is logged in in the current session (cookie set to 'True' or cleared). - The cookie is set to expire at the same time as the sessionid cookie. - - By default, LOGGED_IN_HINT_COOKIE_NAME = 'logged_in_hint'. - """ - - def __init__(self): - if hasattr(settings, 'LOGGED_IN_HINT_COOKIE_NAME'): - self.cookie_name = settings.LOGGED_IN_HINT_COOKIE_NAME - else: self.cookie_name = 'logged_in_hint' - self.cookie_value = 'True' - - def cookie_correct(self, request): - return self.cookie_name in request.COOKIES and request.COOKIES[self.cookie_name] == self.cookie_value - - def process_request(self, request): - if not request.is_secure(): - if self.cookie_correct(request): - # redirect insecure (assuming http) requests with hint cookie to https - url = request.build_absolute_uri() - assert url[:5] == 'http:' - return HttpResponseRedirect('https:' + url[5:]) - return None - - def process_response(self, request, response): - if request.is_secure(): - # assuming full session info (as the conn. is secure) - try: - user = request.user - except AttributeError: # no user - ajax or other special request - return response - if user.is_authenticated(): - if not self.cookie_correct(request): - expiry = None if request.session.get_expire_at_browser_close() else request.session.get_expiry_date() - response.set_cookie(self.cookie_name, value=self.cookie_value, expires=expiry, secure=False) - else: - if self.cookie_name in request.COOKIES: - response.delete_cookie(self.cookie_name) - return response - - -class vzhled: - - def process_request(self, request): - return None - - def process_view(self, request, view_func, view_args, view_kwargs): - #print "====== process_request ======" - #print view_func - #print view_args - #print view_kwargs - #print "=============================" - return None - - def process_template_response(self, request, response): - hodin = datetime.now().hour - if (hodin <= 6) or (hodin >= 14): # TODO 20 - response.context_data['noc'] = True - else: - response.context_data['noc'] = False - return response - - def process_response(self, request, response): - #hodin = datetime.now().hour - #if (hodin <= 6) or (hodin >= 14): # TODO 20 - #response.context_data['noc'] = True - #else: - #response.context_data['noc'] = False - return response - - - ##def process_exception(request, exception): - #pass diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index d5b35281..f737be1e 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -68,9 +68,6 @@ MIDDLEWARE = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', -# FIXME: rozbilo se při přechodu na Django 2.0, nevím, jestli -# se to dá zahodit bez náhrady -# 'mamweb.middleware.LoggedInHintCookieMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', @@ -149,6 +146,7 @@ INSTALLED_APPS = ( 'treenode', 'vyroci', 'sifrovacka', + 'novinky', # Admin upravy: @@ -344,10 +342,6 @@ KOREKTURY_IMG_DIR = os.path.join('korektury', 'img') CISLO_IMG_DIR = os.path.join('cislo', 'img') -# E-MAIL NOTIFICATIONS -POSLI_MAILOVOU_NOTIFIKACI = False - - # Logování chyb class InvalidTemplateVariable(str): diff --git a/mamweb/settings_prod.py b/mamweb/settings_prod.py index 060ba870..4a3f2198 100644 --- a/mamweb/settings_prod.py +++ b/mamweb/settings_prod.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import os.path # @@ -70,5 +68,4 @@ LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/ # E-MAIL NOTIFICATIONS -POSLI_MAILOVOU_NOTIFIKACI = True LOCAL_TEST_PROD = "prod" diff --git a/mamweb/settings_test.py b/mamweb/settings_test.py index dc5beee8..71f166ed 100644 --- a/mamweb/settings_test.py +++ b/mamweb/settings_test.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import os.path # @@ -74,7 +72,6 @@ LOGGING['handlers']['registration_error_log']['filename'] = '/home/mam-web/logs/ FILE_UPLOAD_PERMISSIONS = 0o440 # Testování e-mailů -POSLI_MAILOVOU_NOTIFIKACI = True EMAIL_BACKEND = 'various.mail_prefixer.PrefixingMailBackend' # TODO Pouze na otestování testu… Zvolit konferu! # XXX: Je to pole, protože implementační detail backendu. diff --git a/mamweb/urls.py b/mamweb/urls.py index cdd7df09..4b870fec 100644 --- a/mamweb/urls.py +++ b/mamweb/urls.py @@ -1,18 +1,5 @@ """ -Soubor sloužící jako základní „router“, tj. zde se includují veškeré ostatní urls: - -- ``admin/`` :mod:`django.contrib.admin.site.urls` -- ``ckeditor/`` :mod:`ckeditor_uploader.urls` -- :mod:`seminar.urls` -- :mod:`odevzdavatko.urls` -- :mod:`korektury.urls` -- :mod:`prednasky.urls` -- :mod:`soustredeni.urls` -- :mod:`personalni.urls` -- :mod:`various.autentizace.urls` -- :mod:`api.urls` -- :mod:`treenode.urls` -- :mod:`aesop.urls` +Soubor sloužící jako základní „router“, tj. zde se includují veškeré ostatní urls. """ from django.urls import path, include from django.contrib.staticfiles.urls import staticfiles_urlpatterns diff --git a/novinky/__init__.py b/novinky/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/novinky/admin.py b/novinky/admin.py new file mode 100644 index 00000000..ea822bca --- /dev/null +++ b/novinky/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from .models import Novinky + +admin.site.register(Novinky) diff --git a/novinky/apps.py b/novinky/apps.py new file mode 100644 index 00000000..6aa7efe9 --- /dev/null +++ b/novinky/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + +class NovinkyConfig(AppConfig): + name = 'novinky' + verbose_name = 'Novinky' diff --git a/novinky/migrations/0001_initial.py b/novinky/migrations/0001_initial.py new file mode 100644 index 00000000..0503402c --- /dev/null +++ b/novinky/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:43 + +from django.db import migrations, models + +def nastav_nove_contenttypes(apps, schema_editor): + ContentType = apps.get_model('contenttypes', 'ContentType') + for m in ('novinka'): + oct = ContentType.objects.filter(app_label='seminar', model=m) + oct.update(app_label='novinky') + +def nastav_stare_contenttypes(apps, schema_editor): + ContentType = apps.get_model('contenttypes', 'ContentType') + for m in ('novinka'): + nct = ContentType.objects.filter(app_label='novinky', model=m) + nct.update(app_label='seminar') + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('seminar', '0127_unmanage_novinky'), + ] + + operations = [ + migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes), + migrations.CreateModel( + name='Novinky', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('datum', models.DateField(auto_now_add=True)), + ('text', models.TextField(blank=True, null=True, verbose_name='Text novinky')), + ('obrazek', models.ImageField(blank=True, null=True, upload_to='image_novinky/%Y/%m/%d/', verbose_name='Obrázek')), + ('autor', models.ForeignKey(to='personalni.organizator', verbose_name='Autor novinky', null=True, on_delete=models.SET_NULL)), + ('zverejneno', models.BooleanField(default=False, verbose_name='Zveřejněno')), + ], + options={ + 'verbose_name': 'Novinka', + 'verbose_name_plural': 'Novinky', + 'db_table': 'seminar_novinky', + 'ordering': ['-datum'], + 'managed': False, + }, + ), + ] diff --git a/novinky/migrations/0002_manage_novinky.py b/novinky/migrations/0002_manage_novinky.py new file mode 100644 index 00000000..6c69fe6e --- /dev/null +++ b/novinky/migrations/0002_manage_novinky.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:58 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('novinky', '0001_initial'), + ('seminar', '0128_delete_novinky'), + ] + + operations = [ + migrations.AlterModelOptions( + name='novinky', + options={'ordering': ['-datum'], 'verbose_name': 'Novinka', 'verbose_name_plural': 'Novinky'}, + ), + ] diff --git a/novinky/migrations/0003_novinky_post.py b/novinky/migrations/0003_novinky_post.py new file mode 100644 index 00000000..63cef737 --- /dev/null +++ b/novinky/migrations/0003_novinky_post.py @@ -0,0 +1,13 @@ +# Generated by Django 4.2.13 on 2024-05-13 21:00 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('novinky', '0002_manage_novinky'), + ] + + operations = [ + ] diff --git a/novinky/migrations/__init__.py b/novinky/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/seminar/models/novinky.py b/novinky/models.py similarity index 97% rename from seminar/models/novinky.py rename to novinky/models.py index b67bdfe6..b08faacb 100644 --- a/seminar/models/novinky.py +++ b/novinky/models.py @@ -13,6 +13,7 @@ class Novinky(models.Model): verbose_name = 'Novinka' verbose_name_plural = 'Novinky' ordering = ['-datum'] + db_table = 'seminar_novinky' datum = models.DateField(auto_now_add=True) diff --git a/novinky/views.py b/novinky/views.py new file mode 100644 index 00000000..e69de29b diff --git a/odevzdavatko/admin.py b/odevzdavatko/admin.py index 168beab1..6048eb36 100644 --- a/odevzdavatko/admin.py +++ b/odevzdavatko/admin.py @@ -1,9 +1,3 @@ -""" -Soubor sloužící k definici toho, co bude v adminu. Většinou pouhým zavoláním -funkce :func:`django.contrib.admin.site.register`, v případě, že chceme něco -upravit, tak jako třída rozšiřující :class:`django.contrib.admin.ModelAdmin` -s dekorátorem :func:`django.contrib.admin.register`. -""" from django.contrib import admin from django_reverse_admin import ReverseModelAdmin import seminar.models as m diff --git a/odevzdavatko/apps.py b/odevzdavatko/apps.py index 95811247..98c02c0b 100644 --- a/odevzdavatko/apps.py +++ b/odevzdavatko/apps.py @@ -1,8 +1,6 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig class OdevzdavatkoConfig(AppConfig): name = 'odevzdavatko' + verbose_name = 'Odevzdávátko' diff --git a/odevzdavatko/urls.py b/odevzdavatko/urls.py index 6b021f2e..e41b9c14 100644 --- a/odevzdavatko/urls.py +++ b/odevzdavatko/urls.py @@ -1,17 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- ``org/add_solution`` (seminar_vloz_reseni) :class:`~odevzdavatko.views.PosliReseniView` -- ``resitel/nahraj_reseni`` (seminar_nahraj_reseni) :class:`~odevzdavatko.views.NahrajReseniView` -- ``resitel/odevzdana_reseni/`` (seminar_resitel_odevzdana_reseni) :class:`~odevzdavatko.views.PrehledOdevzdanychReseni` -- ``org/reseni/`` (odevzdavatko_tabulka) :class:`~odevzdavatko.views.TabulkaOdevzdanychReseniView` -- ``org/reseni/rocnik//`` (odevzdavatko_tabulka) :class:`~odevzdavatko.views.TabulkaOdevzdanychReseniView` -- ``org/reseni///`` (odevzdavatko_reseni_resitele_k_problemu) :class:`~odevzdavatko.views.ReseniProblemuView` -- ``org/reseni//`` (odevzdavatko_detail_reseni) :func:`~seminar.utils.viewMethodSwitch` + :class:`~odevzdavatko.views.DetailReseniView` + :func:`~odevzdavatko.views.hodnoceniReseniView` -- ``org/reseni/all`` :class:`~odevzdavatko.views.SeznamReseniView` -- ``org/reseni/akt`` :class:`~odevzdavatko.views.TabulkaOdevzdanychReseniView` -- ``resitel/reseni/`` (odevzdavatko_resitel_reseni) :class:`~odevzdavatko.views.ResitelReseniView` -""" from django.urls import path from seminar.utils import org_required, resitel_required, viewMethodSwitch, \ diff --git a/odevzdavatko/views.py b/odevzdavatko/views.py index 41af1dcb..e5de47c2 100644 --- a/odevzdavatko/views.py +++ b/odevzdavatko/views.py @@ -504,7 +504,7 @@ class NahrajReseniView(LoginRequiredMixin, CreateView): EmailMessage( subject="Nové řešení k " + seznam_do_subjectu, - body=f"Řešitel{ '' if resitel.pohlavi_muz else 'ka' } { resitel } právě nahrál{'' if resitel.pohlavi_muz else 'a' } nové řešení k { seznam }.\n\nHurá do opravování: { self.object.absolute_url() }", + body=f"{resitel} posílá nové řešení k { seznam }.\n\nHurá do opravování: { self.object.absolute_url() }", from_email="submitovatko@mam.mff.cuni.cz", # FIXME: Chceme to mít radši tady, nebo v nastavení? to=list(prijemci), ).send() diff --git a/personalni/admin.py b/personalni/admin.py index 14af2c2c..3418769a 100644 --- a/personalni/admin.py +++ b/personalni/admin.py @@ -5,10 +5,52 @@ from django.contrib.messages import WARNING, ERROR, SUCCESS import seminar.models as m from datetime import datetime +@admin.action(description="Sjednoť telefony") +def sjednot_telefony(admin, request, queryset): + for o in queryset: + if o.telefon == '': + continue + try: + telefon = int(o.telefon.replace(" ", "").replace("+", "")) + # 6 míst + if len(str(telefon)) == 9: + o.telefon = "+420 " + str(telefon)[0:3] + " " + str(telefon)[3:6] + " " + str(telefon)[6:9] + o.save() + # 12 míst + elif len(str(telefon)) == 12: + o.telefon = "+" + str(telefon)[0:3] + " " + str(telefon)[3:6] + " " + str(telefon)[6:9] + " " + str(telefon)[9:12] + o.save() + else: + raise ValueError + except: + admin.message_user(request, f"{o.jmeno} {o.prijmeni} (id: {o.id}) má divný telefon: {o.telefon}", level=ERROR) + admin.message_user(request, "Telefony sjednoceny.", level=SUCCESS) + +# Tohle chceme umět použít i z ResitelAdmin +@admin.action(description="Udělej z vybraných osob organizátory") +def udelej_orgem(admin, request, queryset): + org_group = Group.objects.get(name='org') + uspesne_vytvoreni_orgove = 0 + for o in queryset: + if m.Organizator.objects.filter(osoba=o).exists(): + # Ref: https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.message_user + admin.message_user(request, f"Osoba {o} už je org, přeskakuji.", level=WARNING) + continue + user = o.user + if user is None: + admin.message_user(request, f"Osoba {o} nemá uživatele! Přeskakuji.", level=ERROR) + continue + user.groups.add(org_group) + user.is_staff = True + user.save() + org = m.Organizator.objects.create(osoba=o, organizuje_od=datetime.now()) + org.save() + uspesne_vytvoreni_orgove += 1 + admin.message_user(request, f'Úspěšně vytvořeno {uspesne_vytvoreni_orgove} orgů.', level=SUCCESS) @admin.register(m.Osoba) class OsobaAdmin(admin.ModelAdmin): - actions = ['synchronizuj_maily', 'udelej_orgem'] + actions = ['synchronizuj_maily', udelej_orgem, sjednot_telefony] search_fields = ['jmeno', 'prijmeni', 'prezdivka'] def synchronizuj_maily(self, request, queryset): @@ -20,27 +62,6 @@ class OsobaAdmin(admin.ModelAdmin): self.message_user(request, "E-maily synchronizovány.") synchronizuj_maily.short_description = "Synchronizuj vybraným osobám e-maily do uživatelů" - def udelej_orgem(self,request,queryset): - org_group = Group.objects.get(name='org') - uspesne_vytvoreni_orgove = 0 - for o in queryset: - if m.Organizator.objects.filter(osoba=o).exists(): - # Ref: https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.message_user - self.message_user(request, f"Osoba {o} už je org, přeskakuji.", level=WARNING) - continue - user = o.user - if user is None: - self.message_user(request, f"Osoba {o} nemá uživatele! Přeskakuji.", level=ERROR) - continue - user.groups.add(org_group) - user.is_staff = True - user.save() - org = m.Organizator.objects.create(osoba=o, organizuje_od=datetime.now()) - org.save() - uspesne_vytvoreni_orgove += 1 - self.message_user(request, f'Úspěšně vytvořeno {uspesne_vytvoreni_orgove} orgů.', level=SUCCESS) - udelej_orgem.short_description = "Udělej z vybraných osob organizátory" - class OsobaInline(admin.TabularInline): model = m.Osoba @@ -53,9 +74,16 @@ class OrganizatorAdmin(ReverseModelAdmin): @admin.register(m.Resitel) class ResitelAdmin(ReverseModelAdmin): search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__prezdivka'] + list_filter = ['zasilat', 'zasilat_cislo_papirove', 'zasilat_cislo_emailem', 'rok_maturity'] ordering = ('osoba__prijmeni', 'osoba__jmeno') inline_type = 'stacked' inline_reverse = ['osoba'] + actions = ['udelej_resitele_orgem'] + @admin.action(description="Udělej z řešitelů organizátory") + def udelej_resitele_orgem(self, req, qs): + osoby = m.Osoba.objects.filter(resitel__in=qs) + udelej_orgem(self, req, osoby) + admin.site.register(m.Skola) admin.site.register(m.Prijemce) diff --git a/personalni/apps.py b/personalni/apps.py index 47ba22cc..8312e3ec 100644 --- a/personalni/apps.py +++ b/personalni/apps.py @@ -1,8 +1,6 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig class PersonalniConfig(AppConfig): name = 'personalni' + verbose_name = 'Personální' # Má to nějaký použitelnější název? diff --git a/personalni/forms.py b/personalni/forms.py index 3199a8a2..ea0891e7 100644 --- a/personalni/forms.py +++ b/personalni/forms.py @@ -32,7 +32,7 @@ class UdajeForm(forms.Form): jmeno = forms.CharField(label='Jméno', max_length=256, required=True) prezdivka_resitele = forms.CharField(label='Přezdívka (veřejná)', max_length=256, required=False) prijmeni = forms.CharField(label='Příjmení', max_length=256, required=True) - pohlavi_muz = forms.ChoiceField(label='Pohlaví', choices=((True, 'muž'), (False, 'žena')), required=True) + osloveni = forms.ChoiceField(label='Oslovení', choices=Osoba.OSLOVENI_CHOICES, required=False) email = forms.EmailField(label='E-mail', max_length=256, required=True) telefon = forms.CharField(widget=TelInput(), label='Telefon', max_length=256, required=False) datum_narozeni = forms.DateField(widget=DateInput(), label='Datum narození', required=False) diff --git a/personalni/migrations/0007_post_split_soustredeni.py b/personalni/migrations/0007_post_split_soustredeni.py new file mode 100644 index 00000000..afdf0896 --- /dev/null +++ b/personalni/migrations/0007_post_split_soustredeni.py @@ -0,0 +1,14 @@ +# Generated by Django 4.2.11 on 2024-04-30 21:53 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('personalni', '0006_pre_split_soustredeni'), + ('soustredeni', '0003_post_split_soustredeni'), + ] + + operations = [ + ] diff --git a/personalni/migrations/0008_reforma_pohlavi.py b/personalni/migrations/0008_reforma_pohlavi.py new file mode 100644 index 00000000..ed0862f5 --- /dev/null +++ b/personalni/migrations/0008_reforma_pohlavi.py @@ -0,0 +1,40 @@ +# Generated by Django 4.2.11 on 2024-04-12 14:03 + +from django.db import migrations, models + +# V migracích nemáme Osoba.OSLOVENI_*, tak si to sem nakopíruji. +OSLOVENI_MUZSKE = 'resitel' +OSLOVENI_ZENSKE = 'resitelka' +OSLOVENI_ZADNE = '' + +def pohlavi_to_osloveni(apps, schema_editor): + Osoba = apps.get_model('personalni', 'Osoba') + Osoba.objects.filter(pohlavi_muz=True).update(osloveni=OSLOVENI_MUZSKE) + Osoba.objects.filter(pohlavi_muz=False).update(osloveni=OSLOVENI_ZENSKE) + +def osloveni_to_pohlavi(apps, schema_editor): + Osoba = apps.get_model('personalni', 'Osoba') + nebinarni = Osoba.objects.filter(osloveni=OSLOVENI_ZADNE) + if nebinarni.count() > 0: + raise Exception("Nelze odmigrovat: v databázi jsou nebinární osoby, které starý model nereprezentuje správně.") + Osoba.objects.filter(osloveni=OSLOVENI_MUZSKE).update(pohlavi_muz=True) + Osoba.objects.filter(osloveni=OSLOVENI_MUZSKE).update(pohlavi_muz=False) + +class Migration(migrations.Migration): + + dependencies = [ + ('personalni', '0007_post_split_soustredeni'), + ] + + operations = [ + migrations.AddField( + model_name='osoba', + name='osloveni', + field=models.CharField(blank=True, choices=[('resitel', 'Řešitel'), ('resitelka', 'Řešitelka')], max_length=32, verbose_name='Oslovení'), + ), + migrations.RunPython(pohlavi_to_osloveni, osloveni_to_pohlavi), + migrations.RemoveField( + model_name='osoba', + name='pohlavi_muz', + ), + ] diff --git a/personalni/migrations/0009_novinky_pre.py b/personalni/migrations/0009_novinky_pre.py new file mode 100644 index 00000000..49a94a93 --- /dev/null +++ b/personalni/migrations/0009_novinky_pre.py @@ -0,0 +1,13 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:35 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('personalni', '0008_reforma_pohlavi'), + ] + + operations = [ + ] diff --git a/personalni/migrations/0010_novinky_post.py b/personalni/migrations/0010_novinky_post.py new file mode 100644 index 00000000..8c580214 --- /dev/null +++ b/personalni/migrations/0010_novinky_post.py @@ -0,0 +1,14 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:59 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('personalni', '0009_novinky_pre'), + ('novinky', '0003_novinky_post'), + ] + + operations = [ + ] diff --git a/personalni/migrations/0011_osloveni_vsechny_choices.py b/personalni/migrations/0011_osloveni_vsechny_choices.py new file mode 100644 index 00000000..9b360208 --- /dev/null +++ b/personalni/migrations/0011_osloveni_vsechny_choices.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.13 on 2024-06-03 14:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('personalni', '0010_novinky_post'), + ] + + operations = [ + migrations.AlterField( + model_name='osoba', + name='osloveni', + field=models.CharField(blank=True, choices=[('resitel', 'Řešitel'), ('resitelka', 'Řešitelka'), ('', 'Cokoliv jiného')], max_length=32, verbose_name='Oslovení'), + ), + ] diff --git a/personalni/models.py b/personalni/models.py index dfcc7372..8f6cd63f 100644 --- a/personalni/models.py +++ b/personalni/models.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import logging from django.db import models @@ -38,8 +37,16 @@ class Osoba(SeminarModelBase): user = models.OneToOneField(settings.AUTH_USER_MODEL, blank=True, null=True, verbose_name='uživatel', on_delete=models.DO_NOTHING) - # Pohlaví. Že ho neznáme se snad nestane (a ušetří to práci při programování) - pohlavi_muz = models.BooleanField('pohlaví (muž)', default=False) + # Pohlaví nás prakticky nezajímá, reálně. + OSLOVENI_MUZSKE = 'resitel' + OSLOVENI_ZENSKE = 'resitelka' + OSLOVENI_ZADNE = '' + OSLOVENI_CHOICES = [ + (OSLOVENI_MUZSKE, 'Řešitel'), + (OSLOVENI_ZENSKE, 'Řešitelka'), + (OSLOVENI_ZADNE, 'Cokoliv jiného'), # Reálně nás u nikoho jiného oslovení nezajímá? (A pohlaví už vůbec) + ] + osloveni = models.CharField('Oslovení', choices=OSLOVENI_CHOICES, max_length=32, blank=True) email = models.EmailField('e-mail', max_length=256, blank=True, default='') @@ -246,11 +253,19 @@ class Resitel(SeminarModelBase): def export_row(self): "Slovnik pro pouziti v AESOP exportu" + # Ref: https://opmk.mff.cuni.cz/wiki/aesop/import#telo + + # FUJ: Oslovení nemusí souviset s genderem. + gender = { + Osoba.OSLOVENI_MUZSKE: 'M', + Osoba.OSLOVENI_ZENSKE: 'F', + Osoba.OSLOVENI_ZADNE: '', + }[self.osoba.osloveni] return { 'id': self.id, 'name': self.osoba.jmeno, 'surname': self.osoba.prijmeni, - 'gender': 'M' if self.osoba.pohlavi_muz else 'F', + 'gender': gender, 'born': self.osoba.datum_narozeni.isoformat() if self.osoba.datum_narozeni else '', 'email': self.osoba.email, 'end-year': self.rok_maturity or '', diff --git a/personalni/templates/personalni/profil/orgorozcestnik.html b/personalni/templates/personalni/profil/orgorozcestnik.html index 34c4daba..90d5867d 100644 --- a/personalni/templates/personalni/profil/orgorozcestnik.html +++ b/personalni/templates/personalni/profil/orgorozcestnik.html @@ -13,18 +13,18 @@
  • soustředění
  • -
  • přidat novinku na web
  • +
  • přidat novinku na web

  • Tvorba čísla

      -
    • přidat téma
    • +
    • přidat téma
    • korektury
    • @@ -70,15 +70,15 @@

      Soustředění

        -
      • přidat soustředění
      • +
      • přidat soustředění
      • přednášky
      • -
      • proběhlá soustředění +
      • proběhlá soustředění
        • vytvoření galerie
        • stažení seznamu účastníků
        • @@ -91,7 +91,7 @@

          Můj profil


          @@ -108,6 +108,6 @@

        -

        Nemůžeš najít, co hledáš? Může to být v administračním rozhraní webu.

        +

        Nemůžeš najít, co hledáš? Může to být v administračním rozhraní webu.

        {% endblock content %} diff --git a/personalni/templates/personalni/udaje/udaje.html b/personalni/templates/personalni/udaje/udaje.html index f39e8b47..894ddaf9 100644 --- a/personalni/templates/personalni/udaje/udaje.html +++ b/personalni/templates/personalni/udaje/udaje.html @@ -24,7 +24,7 @@ {% include "personalni/udaje/prihlaska_field.html" with field=form.jmeno %} {% include "personalni/udaje/prihlaska_field.html" with field=form.prezdivka_resitele %} {% include "personalni/udaje/prihlaska_field.html" with field=form.prijmeni %} - {% include "personalni/udaje/prihlaska_field.html" with field=form.pohlavi_muz%} + {% include "personalni/udaje/prihlaska_field.html" with field=form.osloveni%} {% include "personalni/udaje/prihlaska_field.html" with field=form.email %} {% include "personalni/udaje/prihlaska_field.html" with field=form.telefon %} {% include "personalni/udaje/prihlaska_field.html" with field=form.datum_narozeni %} diff --git a/personalni/urls.py b/personalni/urls.py index cbcdb035..73a6f720 100644 --- a/personalni/urls.py +++ b/personalni/urls.py @@ -1,17 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- ``org/add_solution`` (seminar_vloz_reseni) :class:`~odevzdavatko.views.PosliReseniView` -- ``resitel/nahraj_reseni`` (seminar_nahraj_reseni) :class:`~odevzdavatko.views.NahrajReseniView` -- ``resitel/odevzdana_reseni/`` (seminar_resitel_odevzdana_reseni) :class:`~odevzdavatko.views.PrehledOdevzdanychReseni` -- ``org/reseni/`` (odevzdavatko_tabulka) :class:`~odevzdavatko.views.TabulkaOdevzdanychReseniView` -- ``org/reseni/rocnik//`` (odevzdavatko_tabulka) :class:`~odevzdavatko.views.TabulkaOdevzdanychReseniView` -- ``org/reseni///`` (odevzdavatko_reseni_resitele_k_problemu) :class:`~odevzdavatko.views.ReseniProblemuView` -- ``org/reseni//`` (odevzdavatko_detail_reseni) :func:`~seminar.utils.viewMethodSwitch` + :class:`~odevzdavatko.views.DetailReseniView` + :func:`~odevzdavatko.views.hodnoceniReseniView` -- ``org/reseni/all`` :class:`~odevzdavatko.views.SeznamReseniView` -- ``org/reseni/akt`` :class:`~odevzdavatko.views.TabulkaOdevzdanychReseniView` -- ``resitel/reseni/`` (odevzdavatko_resitel_reseni) :class:`~odevzdavatko.views.ResitelReseniView` -""" from django.urls import path from django.contrib.auth.decorators import login_required from . import views diff --git a/personalni/views.py b/personalni/views.py index 876cc7ec..c2712b30 100644 --- a/personalni/views.py +++ b/personalni/views.py @@ -4,7 +4,7 @@ from django.views import generic from django.db.models import Q, Count, Min from django.views.decorators.debug import sensitive_post_parameters from django.views.generic.base import TemplateView -from django.contrib.auth.models import User, Permission, Group +from django.contrib.auth.models import User, Permission, Group, AnonymousUser from django.contrib.auth.mixins import LoginRequiredMixin from django.db import transaction from django.http import HttpResponse @@ -139,7 +139,7 @@ def resitelEditView(request): form_logger.info("EDIT:" + str(fcd) + str(form_hash)) # TODO možná logovat jinak osoba_edit.jmeno = fcd['jmeno'] osoba_edit.prijmeni = fcd['prijmeni'] - osoba_edit.pohlavi_muz = fcd['pohlavi_muz'] + osoba_edit.osloveni = fcd['osloveni'] osoba_edit.email = fcd['email'] osoba_edit.telefon = fcd['telefon'] osoba_edit.ulice = fcd['ulice'] @@ -209,7 +209,7 @@ def prihlaskaView(request): o = s.Osoba( jmeno = fcd['jmeno'], prijmeni = fcd['prijmeni'], - pohlavi_muz = fcd['pohlavi_muz'], + osloveni = fcd['osloveni'], email = fcd['email'], telefon = fcd.get('telefon',''), datum_narozeni = fcd.get('datum_narozeni',None), @@ -242,7 +242,7 @@ def prihlaskaView(request): # Porovnání údajů assert orig_osoba.user is None, "Právě-registrující-se osoba už má Uživatele!" - osoba_attrs = ['jmeno', 'prijmeni', 'pohlavi_muz', 'email', 'telefon', 'datum_narozeni', 'ulice', 'mesto', 'psc', 'stat', 'datum_souhlasu_udaje', 'datum_souhlasu_zasilani', 'datum_registrace'] + osoba_attrs = ['jmeno', 'prijmeni', 'osloveni', 'email', 'telefon', 'datum_narozeni', 'ulice', 'mesto', 'psc', 'stat', 'datum_souhlasu_udaje', 'datum_souhlasu_zasilani', 'datum_registrace'] diffattrs = [] for attr in osoba_attrs: new = getattr(o, attr) @@ -318,6 +318,12 @@ def prihlaskaView(request): # Jen hloupé rozhazovátko def profilView(request): user = request.user + if not isinstance(user, AnonymousUser) and m.Osoba.objects.filter(user=user).count() != 1: + # m.Osoba.objects.get() v ostatních views selže + return render(request, "universal.html", { + 'title': 'Krize identity.', + 'raw_html': r'
        Zvláštní pocit, že jo?
        […]
        Co to znamená?
        — Že ti MaMweb neumí říct, kdo jsi.
        A Admin ano?
        — V tom je rozdíl.
        — Matrix (1999), parafrázováno', + }) if user.has_perm('auth.org'): return OrgoRozcestnikView.as_view()(request) if user.has_perm('auth.resitel'): @@ -339,7 +345,7 @@ def dataResiteluCsvResponse(queryset, columns=None, with_header=True): 'osoba__telefon', 'osoba__user__username', 'osoba__datum_narozeni', - 'osoba__pohlavi_muz', + 'osoba__osloveni', 'osoba__ulice', 'osoba__mesto', 'osoba__psc', @@ -367,7 +373,7 @@ def dataResiteluCsvResponse(queryset, columns=None, with_header=True): 'osoba__telefon': 'telefon', 'osoba__user__username': 'user', 'osoba__datum_narozeni': 'datum_narozeni', - 'osoba__pohlavi_muz': 'pohlavi_muz', + 'osoba__osloveni': 'osloveni', 'osoba__ulice': 'ulice', 'osoba__mesto': 'mesto', 'osoba__psc': 'psc', diff --git a/prednasky/admin.py b/prednasky/admin.py index c9807b27..d086cd0c 100644 --- a/prednasky/admin.py +++ b/prednasky/admin.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.contrib import admin from django.contrib import messages from reversion.admin import VersionAdmin diff --git a/prednasky/forms.py b/prednasky/forms.py index 071d068e..f095a64e 100644 --- a/prednasky/forms.py +++ b/prednasky/forms.py @@ -1,4 +1,3 @@ -# coding: utf-8 from django import forms class NewPrednaskyForm(forms.Form): diff --git a/prednasky/migrations/0001_initial.py b/prednasky/migrations/0001_initial.py index 07da4a4e..06db1d7b 100644 --- a/prednasky/migrations/0001_initial.py +++ b/prednasky/migrations/0001_initial.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0002_auto_20160417_2347.py b/prednasky/migrations/0002_auto_20160417_2347.py index aa09d465..10e5d24c 100644 --- a/prednasky/migrations/0002_auto_20160417_2347.py +++ b/prednasky/migrations/0002_auto_20160417_2347.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0003_auto_20160929_0117.py b/prednasky/migrations/0003_auto_20160929_0117.py index 606d6cf7..3c6929fa 100644 --- a/prednasky/migrations/0003_auto_20160929_0117.py +++ b/prednasky/migrations/0003_auto_20160929_0117.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0004_remove_prednaska_seznam.py b/prednasky/migrations/0004_remove_prednaska_seznam.py index d149199f..4eee9c42 100644 --- a/prednasky/migrations/0004_remove_prednaska_seznam.py +++ b/prednasky/migrations/0004_remove_prednaska_seznam.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0005_auto_20160929_0153.py b/prednasky/migrations/0005_auto_20160929_0153.py index 7ecff0a0..b7aa5814 100644 --- a/prednasky/migrations/0005_auto_20160929_0153.py +++ b/prednasky/migrations/0005_auto_20160929_0153.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0006_hlasovani_seznam.py b/prednasky/migrations/0006_hlasovani_seznam.py index e1b7bd8f..05f9acc3 100644 --- a/prednasky/migrations/0006_hlasovani_seznam.py +++ b/prednasky/migrations/0006_hlasovani_seznam.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0007_prednaska_seznamy.py b/prednasky/migrations/0007_prednaska_seznamy.py index 8f054e17..335cceef 100644 --- a/prednasky/migrations/0007_prednaska_seznamy.py +++ b/prednasky/migrations/0007_prednaska_seznamy.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0008_auto_20160929_0225.py b/prednasky/migrations/0008_auto_20160929_0225.py index a5bbb92e..054ad059 100644 --- a/prednasky/migrations/0008_auto_20160929_0225.py +++ b/prednasky/migrations/0008_auto_20160929_0225.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0009_auto_20160929_0354.py b/prednasky/migrations/0009_auto_20160929_0354.py index 6b4f9486..5b5bb54f 100644 --- a/prednasky/migrations/0009_auto_20160929_0354.py +++ b/prednasky/migrations/0009_auto_20160929_0354.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0010_auto_20160929_0508.py b/prednasky/migrations/0010_auto_20160929_0508.py index b654e23f..30a33395 100644 --- a/prednasky/migrations/0010_auto_20160929_0508.py +++ b/prednasky/migrations/0010_auto_20160929_0508.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/prednasky/migrations/0011_auto_20190430_2340.py b/prednasky/migrations/0011_auto_20190430_2340.py index a01d1878..dc081254 100644 --- a/prednasky/migrations/0011_auto_20190430_2340.py +++ b/prednasky/migrations/0011_auto_20190430_2340.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-04-30 21:40 from __future__ import unicode_literals diff --git a/prednasky/migrations/0012_auto_20190610_2358.py b/prednasky/migrations/0012_auto_20190610_2358.py index 1ca6db83..f6551d8a 100644 --- a/prednasky/migrations/0012_auto_20190610_2358.py +++ b/prednasky/migrations/0012_auto_20190610_2358.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.21 on 2019-06-10 21:58 from __future__ import unicode_literals diff --git a/prednasky/models.py b/prednasky/models.py index 54764381..74b37403 100644 --- a/prednasky/models.py +++ b/prednasky/models.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.db import models from soustredeni.models import Soustredeni diff --git a/prednasky/tests.py b/prednasky/tests.py deleted file mode 100644 index 7ce503c2..00000000 --- a/prednasky/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/prednasky/urls.py b/prednasky/urls.py index d0e7a703..6b455163 100644 --- a/prednasky/urls.py +++ b/prednasky/urls.py @@ -1,12 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- ``prednasky/`` :func:`~prednasky.views.newPrednaska` -- ``prednasky/hotovo`` :func:`~prednasky.views.Prednaska_hotovo` -- ``prednasky/metaseznam_prednasek`` (metaseznam-list) :class:`~prednasky.views.MetaSeznamListView` -- ``prednasky/seznam_prednasek//export`` (seznam-export) :func:`~prednasky.views.SeznamExportView` -- ``prednasky/seznam_prednasek//`` (seznam-list) :class:`~prednasky.views.SeznamListView` -""" from django.urls import path from seminar.utils import org_required, resitel_or_org_required from . import views diff --git a/prednasky/views.py b/prednasky/views.py index 2c370b7a..699b690d 100644 --- a/prednasky/views.py +++ b/prednasky/views.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.shortcuts import render, get_object_or_404 from django.views import generic from django.shortcuts import HttpResponseRedirect diff --git a/requirements.txt b/requirements.txt index ecc41db0..bba1bad0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -# -*- coding: utf-8 -*- -c constraints.txt -# basic libs +setuptools # django-polymorphic má rozbité dependencies +# basic libs psycopg2 # PostgreSQL adaptér ipython # Interaktivní shell Unidecode # Přepisuje unicode do ASCII (např. soubory nebo e-maily) diff --git a/seminar/admin.py b/seminar/admin.py index 8f589a03..f8768ddf 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -178,12 +178,6 @@ class TextAdminInline(admin.TabularInline): admin.site.register(m.Text) -class ResitelInline(admin.TabularInline): - model = m.Resitel - extra = 1 - - # admin.site.register(m.Pohadka) admin.site.register(m.Obrazek) admin.site.register(m.Nastaveni, SingletonModelAdmin) -admin.site.register(m.Novinky) diff --git a/seminar/apps.py b/seminar/apps.py new file mode 100644 index 00000000..ce66f627 --- /dev/null +++ b/seminar/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + +class SeminarConfig(AppConfig): + name = 'seminar' + verbose_name = 'Seminář' + diff --git a/seminar/management/commands/load_org_permissions.py b/seminar/management/commands/load_org_permissions.py index c1e4a106..6b4f9e0a 100644 --- a/seminar/management/commands/load_org_permissions.py +++ b/seminar/management/commands/load_org_permissions.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.core.management.base import BaseCommand from django.contrib.sessions.models import Session from django.contrib.auth.models import Group, Permission diff --git a/seminar/management/commands/save_org_permissions.py b/seminar/management/commands/save_org_permissions.py index a6814e6f..216f9e4b 100644 --- a/seminar/management/commands/save_org_permissions.py +++ b/seminar/management/commands/save_org_permissions.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.core.management.base import BaseCommand from django.contrib.sessions.models import Session from django.contrib.auth.models import Group, Permission diff --git a/seminar/management/commands/testdata.py b/seminar/management/commands/testdata.py index dbbd908d..d9ce8cfb 100644 --- a/seminar/management/commands/testdata.py +++ b/seminar/management/commands/testdata.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import datetime import os import random diff --git a/seminar/migrations/0001_initial.py b/seminar/migrations/0001_initial.py index 088193b3..cd36a7dc 100644 --- a/seminar/migrations/0001_initial.py +++ b/seminar/migrations/0001_initial.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0002_add_body_views.py b/seminar/migrations/0002_add_body_views.py index 3d128ab9..1ece029e 100644 --- a/seminar/migrations/0002_add_body_views.py +++ b/seminar/migrations/0002_add_body_views.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0003_add_skola_zs_ss.py b/seminar/migrations/0003_add_skola_zs_ss.py index 1b1fbb80..478e49d3 100644 --- a/seminar/migrations/0003_add_skola_zs_ss.py +++ b/seminar/migrations/0003_add_skola_zs_ss.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0004_add_old_dakos_id.py b/seminar/migrations/0004_add_old_dakos_id.py index 1ec28943..769232cb 100644 --- a/seminar/migrations/0004_add_old_dakos_id.py +++ b/seminar/migrations/0004_add_old_dakos_id.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0005_alter_problem_autor.py b/seminar/migrations/0005_alter_problem_autor.py index d8a40585..d7763ecc 100644 --- a/seminar/migrations/0005_alter_problem_autor.py +++ b/seminar/migrations/0005_alter_problem_autor.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0006_problem_add_timestamp.py b/seminar/migrations/0006_problem_add_timestamp.py index fd1509de..dd5fd94c 100644 --- a/seminar/migrations/0006_problem_add_timestamp.py +++ b/seminar/migrations/0006_problem_add_timestamp.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0007_problem_zamereni.py b/seminar/migrations/0007_problem_zamereni.py index 10718bd7..d1363cde 100644 --- a/seminar/migrations/0007_problem_zamereni.py +++ b/seminar/migrations/0007_problem_zamereni.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0008_reseni_forma.py b/seminar/migrations/0008_reseni_forma.py index 399e81a9..22b36d43 100644 --- a/seminar/migrations/0008_reseni_forma.py +++ b/seminar/migrations/0008_reseni_forma.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0009_rename_imported_IDs.py b/seminar/migrations/0009_rename_imported_IDs.py index 997bc0ac..06eaf074 100644 --- a/seminar/migrations/0009_rename_imported_IDs.py +++ b/seminar/migrations/0009_rename_imported_IDs.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0010_alter_rok_maturity.py b/seminar/migrations/0010_alter_rok_maturity.py index 58c099fb..bfae4d5f 100644 --- a/seminar/migrations/0010_alter_rok_maturity.py +++ b/seminar/migrations/0010_alter_rok_maturity.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0011_alter_timestamp_def.py b/seminar/migrations/0011_alter_timestamp_def.py index 238386a6..90582816 100644 --- a/seminar/migrations/0011_alter_timestamp_def.py +++ b/seminar/migrations/0011_alter_timestamp_def.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0012_remove_soustredeni_ucastnici.py b/seminar/migrations/0012_remove_soustredeni_ucastnici.py index ddb61304..2011659c 100644 --- a/seminar/migrations/0012_remove_soustredeni_ucastnici.py +++ b/seminar/migrations/0012_remove_soustredeni_ucastnici.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0013_soustredeni_ucastnici_through_model.py b/seminar/migrations/0013_soustredeni_ucastnici_through_model.py index c725691d..944ae080 100644 --- a/seminar/migrations/0013_soustredeni_ucastnici_through_model.py +++ b/seminar/migrations/0013_soustredeni_ucastnici_through_model.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0014_uprava_poznamek.py b/seminar/migrations/0014_uprava_poznamek.py index 0eb34984..ee52c65b 100644 --- a/seminar/migrations/0014_uprava_poznamek.py +++ b/seminar/migrations/0014_uprava_poznamek.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0015_soustredeni_text.py b/seminar/migrations/0015_soustredeni_text.py index 87298eba..4f9ebd88 100644 --- a/seminar/migrations/0015_soustredeni_text.py +++ b/seminar/migrations/0015_soustredeni_text.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0016_texty_problemu.py b/seminar/migrations/0016_texty_problemu.py index 451c888e..0e91f010 100644 --- a/seminar/migrations/0016_texty_problemu.py +++ b/seminar/migrations/0016_texty_problemu.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0017_texty_problemu_minor.py b/seminar/migrations/0017_texty_problemu_minor.py index f732c111..cd3f2a1c 100644 --- a/seminar/migrations/0017_texty_problemu_minor.py +++ b/seminar/migrations/0017_texty_problemu_minor.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0018_problemnavrh_problemzadany.py b/seminar/migrations/0018_problemnavrh_problemzadany.py index afdcfa8c..42c448f9 100644 --- a/seminar/migrations/0018_problemnavrh_problemzadany.py +++ b/seminar/migrations/0018_problemnavrh_problemzadany.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0019_rocnik_ciselne.py b/seminar/migrations/0019_rocnik_ciselne.py index da9591aa..72055d18 100644 --- a/seminar/migrations/0019_rocnik_ciselne.py +++ b/seminar/migrations/0019_rocnik_ciselne.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0020_indexy_a_razeni.py b/seminar/migrations/0020_indexy_a_razeni.py index 1e199f0e..59674291 100644 --- a/seminar/migrations/0020_indexy_a_razeni.py +++ b/seminar/migrations/0020_indexy_a_razeni.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0021_cislo_verejna_vysledkovka.py b/seminar/migrations/0021_cislo_verejna_vysledkovka.py index d4d34c7f..19768357 100644 --- a/seminar/migrations/0021_cislo_verejna_vysledkovka.py +++ b/seminar/migrations/0021_cislo_verejna_vysledkovka.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0022_decimal_body.py b/seminar/migrations/0022_decimal_body.py index ff92fcde..22acbf99 100644 --- a/seminar/migrations/0022_decimal_body.py +++ b/seminar/migrations/0022_decimal_body.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals import importlib diff --git a/seminar/migrations/0023_add_novinky.py b/seminar/migrations/0023_add_novinky.py index 7db2a005..6e5db0c4 100644 --- a/seminar/migrations/0023_add_novinky.py +++ b/seminar/migrations/0023_add_novinky.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0024_add_organizator.py b/seminar/migrations/0024_add_organizator.py index 16faee72..4ce7a5e3 100644 --- a/seminar/migrations/0024_add_organizator.py +++ b/seminar/migrations/0024_add_organizator.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py b/seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py index 23e02c95..0d1ee7b4 100644 --- a/seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py +++ b/seminar/migrations/0025_zmena_cesty_nahravani_obrazku.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0026_soustredeni_typ.py b/seminar/migrations/0026_soustredeni_typ.py index 46d3416f..3c97c387 100644 --- a/seminar/migrations/0026_soustredeni_typ.py +++ b/seminar/migrations/0026_soustredeni_typ.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0027_export_flag_a_typ_akce.py b/seminar/migrations/0027_export_flag_a_typ_akce.py index e7172dcc..e6616f36 100644 --- a/seminar/migrations/0027_export_flag_a_typ_akce.py +++ b/seminar/migrations/0027_export_flag_a_typ_akce.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0028_add_body_celkem_views.py b/seminar/migrations/0028_add_body_celkem_views.py index 0f6799f0..c26baec2 100644 --- a/seminar/migrations/0028_add_body_celkem_views.py +++ b/seminar/migrations/0028_add_body_celkem_views.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0029_fix_body_celkem_views.py b/seminar/migrations/0029_fix_body_celkem_views.py index 5e287747..b2b9f24a 100644 --- a/seminar/migrations/0029_fix_body_celkem_views.py +++ b/seminar/migrations/0029_fix_body_celkem_views.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0030_add_vysledky.py b/seminar/migrations/0030_add_vysledky.py index 06842c6b..65289e23 100644 --- a/seminar/migrations/0030_add_vysledky.py +++ b/seminar/migrations/0030_add_vysledky.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0031_cislo_pdf.py b/seminar/migrations/0031_cislo_pdf.py index c51570bf..b2b65102 100644 --- a/seminar/migrations/0031_cislo_pdf.py +++ b/seminar/migrations/0031_cislo_pdf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0032_cislo_pdf_blank_typos.py b/seminar/migrations/0032_cislo_pdf_blank_typos.py index b16c4501..b72ad75d 100644 --- a/seminar/migrations/0032_cislo_pdf_blank_typos.py +++ b/seminar/migrations/0032_cislo_pdf_blank_typos.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0033_organizator_studuje_popisek.py b/seminar/migrations/0033_organizator_studuje_popisek.py index 07f15712..cc9f7e63 100644 --- a/seminar/migrations/0033_organizator_studuje_popisek.py +++ b/seminar/migrations/0033_organizator_studuje_popisek.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0034_reseni_forma_default_email.py b/seminar/migrations/0034_reseni_forma_default_email.py index 2d691b30..6cbe180c 100644 --- a/seminar/migrations/0034_reseni_forma_default_email.py +++ b/seminar/migrations/0034_reseni_forma_default_email.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0035_django_imagekit.py b/seminar/migrations/0035_django_imagekit.py index dd443018..ba18c7cc 100644 --- a/seminar/migrations/0035_django_imagekit.py +++ b/seminar/migrations/0035_django_imagekit.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0036_add_org_to_soustredeni.py b/seminar/migrations/0036_add_org_to_soustredeni.py index 4db43239..357cdf7b 100644 --- a/seminar/migrations/0036_add_org_to_soustredeni.py +++ b/seminar/migrations/0036_add_org_to_soustredeni.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations diff --git a/seminar/migrations/0037_prispevek.py b/seminar/migrations/0037_prispevek.py index c4c3b867..cb32f983 100644 --- a/seminar/migrations/0037_prispevek.py +++ b/seminar/migrations/0037_prispevek.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0038_change_meta_prispevek.py b/seminar/migrations/0038_change_meta_prispevek.py index 5378e57e..80a2bef5 100644 --- a/seminar/migrations/0038_change_meta_prispevek.py +++ b/seminar/migrations/0038_change_meta_prispevek.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0039_pohadka.py b/seminar/migrations/0039_pohadka.py index f798bd75..4636accc 100644 --- a/seminar/migrations/0039_pohadka.py +++ b/seminar/migrations/0039_pohadka.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0040_pohadka_nepovinny_autor.py b/seminar/migrations/0040_pohadka_nepovinny_autor.py index babf9b24..5be7ac80 100644 --- a/seminar/migrations/0040_pohadka_nepovinny_autor.py +++ b/seminar/migrations/0040_pohadka_nepovinny_autor.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0041_konfery.py b/seminar/migrations/0041_konfery.py index 9fddbe17..bb040465 100644 --- a/seminar/migrations/0041_konfery.py +++ b/seminar/migrations/0041_konfery.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0042_auto_20161005_0847.py b/seminar/migrations/0042_auto_20161005_0847.py index 27930952..e606e325 100644 --- a/seminar/migrations/0042_auto_20161005_0847.py +++ b/seminar/migrations/0042_auto_20161005_0847.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0042_cislo_faze.py b/seminar/migrations/0042_cislo_faze.py index 7d35ace5..0685e932 100644 --- a/seminar/migrations/0042_cislo_faze.py +++ b/seminar/migrations/0042_cislo_faze.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0043_uprava_faze.py b/seminar/migrations/0043_uprava_faze.py index 29e06e01..aff30bc3 100644 --- a/seminar/migrations/0043_uprava_faze.py +++ b/seminar/migrations/0043_uprava_faze.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0044_uprava_faze.py b/seminar/migrations/0044_uprava_faze.py index 0d683d6c..e05d56a8 100644 --- a/seminar/migrations/0044_uprava_faze.py +++ b/seminar/migrations/0044_uprava_faze.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0045_cislo_pridani_faze_nahrano.py b/seminar/migrations/0045_cislo_pridani_faze_nahrano.py index 06ca8201..a48db840 100644 --- a/seminar/migrations/0045_cislo_pridani_faze_nahrano.py +++ b/seminar/migrations/0045_cislo_pridani_faze_nahrano.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0046_merge.py b/seminar/migrations/0046_merge.py index 19352440..46496f5c 100644 --- a/seminar/migrations/0046_merge.py +++ b/seminar/migrations/0046_merge.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0047_auto_20170120_2118.py b/seminar/migrations/0047_auto_20170120_2118.py index 1876fe25..4486d786 100644 --- a/seminar/migrations/0047_auto_20170120_2118.py +++ b/seminar/migrations/0047_auto_20170120_2118.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0048_add_cislo_datum_deadline_soustredeni.py b/seminar/migrations/0048_add_cislo_datum_deadline_soustredeni.py index 134a00a8..71df4284 100644 --- a/seminar/migrations/0048_add_cislo_datum_deadline_soustredeni.py +++ b/seminar/migrations/0048_add_cislo_datum_deadline_soustredeni.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models diff --git a/seminar/migrations/0049_auto_20190430_2354.py b/seminar/migrations/0049_auto_20190430_2354.py index 14fa23d8..3fb7c437 100644 --- a/seminar/migrations/0049_auto_20190430_2354.py +++ b/seminar/migrations/0049_auto_20190430_2354.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-04-30 21:54 from __future__ import unicode_literals diff --git a/seminar/migrations/0050_auto_20190510_2228.py b/seminar/migrations/0050_auto_20190510_2228.py index a9afc764..86f2639b 100644 --- a/seminar/migrations/0050_auto_20190510_2228.py +++ b/seminar/migrations/0050_auto_20190510_2228.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-10 20:28 from __future__ import unicode_literals diff --git a/seminar/migrations/0051_resitel_to_osoba.py b/seminar/migrations/0051_resitel_to_osoba.py index 6644ab7d..81eab2d5 100644 --- a/seminar/migrations/0051_resitel_to_osoba.py +++ b/seminar/migrations/0051_resitel_to_osoba.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-10 20:44 from __future__ import unicode_literals diff --git a/seminar/migrations/0052_user_to_organizator.py b/seminar/migrations/0052_user_to_organizator.py index a91a7966..0577a0e0 100644 --- a/seminar/migrations/0052_user_to_organizator.py +++ b/seminar/migrations/0052_user_to_organizator.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2019-05-16 20:59 from __future__ import unicode_literals diff --git a/seminar/migrations/0053_organizator_organizuje_od_do.py b/seminar/migrations/0053_organizator_organizuje_od_do.py index b94e8032..b46b93de 100644 --- a/seminar/migrations/0053_organizator_organizuje_od_do.py +++ b/seminar/migrations/0053_organizator_organizuje_od_do.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-16 21:26 from __future__ import unicode_literals diff --git a/seminar/migrations/0055_smazat_nemigrovane_zastarale_veci.py b/seminar/migrations/0055_smazat_nemigrovane_zastarale_veci.py index 1b6f95f4..66eae38c 100644 --- a/seminar/migrations/0055_smazat_nemigrovane_zastarale_veci.py +++ b/seminar/migrations/0055_smazat_nemigrovane_zastarale_veci.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-23 20:16 from __future__ import unicode_literals diff --git a/seminar/migrations/0056_vrcholy_pro_rocniky_a_cisla.py b/seminar/migrations/0056_vrcholy_pro_rocniky_a_cisla.py index 56146261..4c755c48 100644 --- a/seminar/migrations/0056_vrcholy_pro_rocniky_a_cisla.py +++ b/seminar/migrations/0056_vrcholy_pro_rocniky_a_cisla.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-23 21:54 from __future__ import unicode_literals diff --git a/seminar/migrations/0057_reseni_to_reseni_hodnoceni.py b/seminar/migrations/0057_reseni_to_reseni_hodnoceni.py index a11d99ae..9e162b94 100644 --- a/seminar/migrations/0057_reseni_to_reseni_hodnoceni.py +++ b/seminar/migrations/0057_reseni_to_reseni_hodnoceni.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-28 21:46 from __future__ import unicode_literals diff --git a/seminar/migrations/0058_problem_to_uloha_tema_clanek.py b/seminar/migrations/0058_problem_to_uloha_tema_clanek.py index 4ef135c4..f8fbc87b 100644 --- a/seminar/migrations/0058_problem_to_uloha_tema_clanek.py +++ b/seminar/migrations/0058_problem_to_uloha_tema_clanek.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-17 17:44 from __future__ import unicode_literals diff --git a/seminar/migrations/0059_vytvorit_pohadkanode.py b/seminar/migrations/0059_vytvorit_pohadkanode.py index 2a78c7ee..8aca874b 100644 --- a/seminar/migrations/0059_vytvorit_pohadkanode.py +++ b/seminar/migrations/0059_vytvorit_pohadkanode.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-29 03:26 from __future__ import unicode_literals diff --git a/seminar/migrations/0060_spoj_stromy.py b/seminar/migrations/0060_spoj_stromy.py index d0826ca1..6bf74f28 100644 --- a/seminar/migrations/0060_spoj_stromy.py +++ b/seminar/migrations/0060_spoj_stromy.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-29 03:26 from __future__ import unicode_literals diff --git a/seminar/migrations/0061_kill_frankenstein.py b/seminar/migrations/0061_kill_frankenstein.py index 0a367edf..80cde7a1 100644 --- a/seminar/migrations/0061_kill_frankenstein.py +++ b/seminar/migrations/0061_kill_frankenstein.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-29 03:29 from __future__ import unicode_literals diff --git a/seminar/migrations/0062_redukce_modelu_pohadky.py b/seminar/migrations/0062_redukce_modelu_pohadky.py index b4e5f11e..80bf280e 100644 --- a/seminar/migrations/0062_redukce_modelu_pohadky.py +++ b/seminar/migrations/0062_redukce_modelu_pohadky.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-30 01:16 from __future__ import unicode_literals diff --git a/seminar/migrations/0063_procisteni_migraci.py b/seminar/migrations/0063_procisteni_migraci.py index 3dce57ad..52f84179 100644 --- a/seminar/migrations/0063_procisteni_migraci.py +++ b/seminar/migrations/0063_procisteni_migraci.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-05-30 01:32 from __future__ import unicode_literals diff --git a/seminar/migrations/0064_auto_20190610_2358.py b/seminar/migrations/0064_auto_20190610_2358.py index 78e62862..8f1a90f4 100644 --- a/seminar/migrations/0064_auto_20190610_2358.py +++ b/seminar/migrations/0064_auto_20190610_2358.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.21 on 2019-06-10 21:58 from __future__ import unicode_literals diff --git a/seminar/migrations/0117_auto_20240312_2125.py b/seminar/migrations/0117_auto_20240312_2125.py index 57b2431f..0134534a 100644 --- a/seminar/migrations/0117_auto_20240312_2125.py +++ b/seminar/migrations/0117_auto_20240312_2125.py @@ -7,9 +7,11 @@ class Migration(migrations.Migration): dependencies = [ ('seminar', '0116_delete_nastaveni'), - ('personalni', '0001_skupiny'), + ('various', '0003_fix_permissions'), # Zapomenutá post-split migrace, suplujeme tady. + ('personalni', '0001_skupiny'), # Mělo být spíš 0002_auto_20240312_2118, ale to je no-op, tak je to jedno. ('korektury', '0021_auto_20240312_2124'), ('sifrovacka', '0004_auto_20240312_2124'), + ('prednasky', '0013_auto_20240312_2124'), ] operations = [ diff --git a/seminar/migrations/0126_novinky_pre.py b/seminar/migrations/0126_novinky_pre.py new file mode 100644 index 00000000..644abb44 --- /dev/null +++ b/seminar/migrations/0126_novinky_pre.py @@ -0,0 +1,14 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:36 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0125_post_split_soustredeni'), + ('personalni', '0009_novinky_pre'), + ] + + operations = [ + ] diff --git a/seminar/migrations/0127_unmanage_novinky.py b/seminar/migrations/0127_unmanage_novinky.py new file mode 100644 index 00000000..afca5443 --- /dev/null +++ b/seminar/migrations/0127_unmanage_novinky.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:41 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0126_novinky_pre'), + ] + + operations = [ + migrations.AlterModelOptions( + name='novinky', + options={'managed': False, 'ordering': ['-datum'], 'verbose_name': 'Novinka', 'verbose_name_plural': 'Novinky'}, + ), + ] diff --git a/seminar/migrations/0128_delete_novinky.py b/seminar/migrations/0128_delete_novinky.py new file mode 100644 index 00000000..9708a09a --- /dev/null +++ b/seminar/migrations/0128_delete_novinky.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:54 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0127_unmanage_novinky'), + ('novinky', '0001_initial'), + ] + + operations = [ + migrations.DeleteModel( + name='Novinky', + ), + ] diff --git a/seminar/migrations/0129_novinky_post.py b/seminar/migrations/0129_novinky_post.py new file mode 100644 index 00000000..11b2b587 --- /dev/null +++ b/seminar/migrations/0129_novinky_post.py @@ -0,0 +1,14 @@ +# Generated by Django 4.2.13 on 2024-05-13 20:59 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0128_delete_novinky'), + ('novinky', '0003_novinky_post'), + ] + + operations = [ + ] diff --git a/seminar/migrations/0130_clanek_strana.py b/seminar/migrations/0130_clanek_strana.py new file mode 100644 index 00000000..d2f985fb --- /dev/null +++ b/seminar/migrations/0130_clanek_strana.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.13 on 2024-06-15 21:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0129_novinky_post'), + ] + + operations = [ + migrations.AddField( + model_name='clanek', + name='strana', + field=models.PositiveIntegerField(blank=True, null=True, verbose_name='první strana'), + ), + ] diff --git a/seminar/models/__init__.py b/seminar/models/__init__.py index 121aeb04..e404864a 100644 --- a/seminar/models/__init__.py +++ b/seminar/models/__init__.py @@ -3,11 +3,11 @@ from .odevzdavatko import * from .base import * from .pomocne import * from .treenode import * -from .novinky import * from various.models import Nastaveni from personalni.models import Organizator, Resitel, Skola, Prijemce, Osoba from soustredeni.models import Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Konfera, Konfery_Ucastnici +from novinky.models import Novinky # Kvůli migr. 0041 from soustredeni.models import generate_filename_konfera diff --git a/seminar/models/pomocne.py b/seminar/models/pomocne.py index cb552a67..9fc6b7cd 100644 --- a/seminar/models/pomocne.py +++ b/seminar/models/pomocne.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import logging import os from django.db import models diff --git a/seminar/models/treenode.py b/seminar/models/treenode.py index 735501c0..abc20eab 100644 --- a/seminar/models/treenode.py +++ b/seminar/models/treenode.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import logging from django.db import models diff --git a/seminar/models/tvorba.py b/seminar/models/tvorba.py index 1dd9db8e..36157c96 100644 --- a/seminar/models/tvorba.py +++ b/seminar/models/tvorba.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import datetime import os import subprocess @@ -285,9 +284,6 @@ class Cislo(SeminarModelBase): def posli(subject, text, resitele): emaily = map(lambda resitel: resitel.osoba.email, resitele) - if not settings.POSLI_MAILOVOU_NOTIFIKACI: - print("Poslal bych upozornění na tyto adresy: ", " ".join(emaily)) - return email = EmailMessage( subject=subject, @@ -600,6 +596,8 @@ class Clanek(Problem): cislo = models.ForeignKey(Cislo, blank=True, null=True, on_delete=models.PROTECT, verbose_name='číslo vydání', related_name='vydane_clanky') + + strana = models.PositiveIntegerField(verbose_name="první strana", blank=True, null=True) @cached_property def kod_v_rocniku(self): diff --git a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex index bebd5632..de271652 100644 --- a/seminar/templates/seminar/archiv/cislo_vysledkovka.tex +++ b/seminar/templates/seminar/archiv/cislo_vysledkovka.tex @@ -1,6 +1,7 @@ \setlength{\tabcolsep}{3pt} +{% if vysledkovka.je_nejake_ostatni %}\global\vysledkovkaostatnitrue{% else %}\global\vysledkovkaostatnifalse{% endif %} \begin{longtable}{|r|l|c|r|{% for p in vysledkovka.temata_a_spol %}c@{\hskip.5em}{% endfor %}{% if vysledkovka.je_nejake_ostatni %}|c@{\hskip.5em}{% endif %}|r|r|}\hline -& & & & \multicolumn{ {{ vysledkovka.temata_a_spol|length}} }{c|}{\textbf{Témata}} & & {% if vysledkovka.je_nejake_ostatni %}&{\hskip.5em}{% endif %} \\\textbf{Poř.}& \textbf{Jméno}& \textbf{R.}& \raisebox{0.7mm}{$\sum_{-1}$}& {% for p in vysledkovka.temata_a_spol %}\textbf{ {{ p.kod_v_rocniku }} }&{% endfor %}{% if vysledkovka.je_nejake_ostatni %}\textbf{Ostatní}&{% endif %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline +& & & & \multicolumn{ {{ vysledkovka.temata_a_spol|length}} }{c|}{\textbf{Témata}} & & {% if vysledkovka.je_nejake_ostatni %}&{\hskip.5em}{% endif %} \\\textbf{Poř.}& \textbf{Jméno}& \textbf{R.}& \raisebox{0.7mm}{$\sum_{-1}$}& {% for p in vysledkovka.temata_a_spol %}\textbf{ {{ p.kod_v_rocniku }} }&{% endfor %}{% if vysledkovka.je_nejake_ostatni %}\textbf{O}&{% endif %}\raisebox{0.7mm}{$\sum_0$}&\raisebox{0.7mm}{$\sum_1$}\\\hline \endhead \hline \endfoot diff --git a/seminar/templates/seminar/clanky/resitelske_clanky.html b/seminar/templates/seminar/clanky/resitelske_clanky.html index 2bcc7a6b..0c808bda 100644 --- a/seminar/templates/seminar/clanky/resitelske_clanky.html +++ b/seminar/templates/seminar/clanky/resitelske_clanky.html @@ -17,7 +17,7 @@ {% endifchanged %}
      • {% if clanek.cislo.pdf %} - + {{ clanek.nazev }} ({% for r in clanek.reseni_set.first.resitele.all %}{{r}}{% if not forloop.last %}, {% endif %}{% endfor %}) diff --git a/seminar/testutils.py b/seminar/testutils.py index c3d64f56..be7f3677 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import datetime from django.contrib.auth.models import Permission @@ -58,17 +56,19 @@ def gen_osoby(rnd, size): # 30 je náhodná konstanta, size je použité na víc místech a # říká, jak velká asi chceme testovací data for i in range(30 * size): - pohlavi = rnd.randint(0,1) - jmeno = rnd.choice([jmena_m, jmena_f][pohlavi]) - prijmeni = rnd.choice([prijmeni_m, prijmeni_f][pohlavi]) + pohlavi_idx = rnd.randint(0,2) # 2 = nebinární + osloveni = [Osoba.OSLOVENI_MUZSKE, Osoba.OSLOVENI_ZENSKE, Osoba.OSLOVENI_ZADNE][pohlavi_idx] + jmeno = rnd.choice([jmena_m, jmena_f, jmena_m + jmena_f][pohlavi_idx]) + prijmeni = rnd.choice([prijmeni_m, prijmeni_f, prijmeni_m + prijmeni_f][pohlavi_idx]) + if pohlavi_idx == 2: logger.debug(f'Testdata: nebinární osoba: {jmeno} {prijmeni}.') pokusy = 0 max_pokusy = 120*size while (not __unikatni_jmeno and pokusy < max_pokusy): # pokud jméno a příjmení není unikátní, zkoušíme generovat nová # do daného limitu (abychom se nezacyklili do nekonečna při málo jménech a příjmeních # ze kterých se generuje) - jmeno = rnd.choice([jmena_m, jmena_f][pohlavi]) - prijmeni = rnd.choice([prijmeni_m, prijmeni_f][pohlavi]) + jmeno = rnd.choice([jmena_m, jmena_f, jmena_m + jmena_f][pohlavi_idx]) + prijmeni = rnd.choice([prijmeni_m, prijmeni_f, prijmeni_m + prijmeni_f][pohlavi_idx]) pokusy = pokusy + 1 if pokusy >= max_pokusy: print("Chyba, na danou velikost testovacích dat příliš málo možných" @@ -86,7 +86,7 @@ def gen_osoby(rnd, size): psc = "".join([str(rnd.choice([k for k in range(10)])) for i in range(5)]) osoby.append(Osoba.objects.create(jmeno = jmeno, prijmeni = prijmeni, - prezdivka = prezdivka, pohlavi_muz = pohlavi, email = email, + prezdivka = prezdivka, osloveni = osloveni, email = email, telefon = telefon, datum_narozeni = narozeni, ulice = ulice, mesto = mesto, psc = psc, datum_registrace = datetime.date(rnd.randint(2019, 2029), @@ -818,7 +818,7 @@ def create_test_data(size = 6, rnd = None): admin = User.objects.create_superuser(username='admin', email='', password='admin') os_admin = Osoba.objects.create( user=admin, jmeno='admin', prijmeni='admin', - prezdivka='admin', pohlavi_muz=1, email='admin@admin.admin', + prezdivka='admin', osloveni='', email='admin@admin.admin', telefon='123 456 789', datum_narozeni=datetime.date(2000, 1, 1), ulice='admin', mesto='admin', psc='100 00', datum_registrace=datetime.date(2020, 9, 6) diff --git a/seminar/urls.py b/seminar/urls.py index f6f2e2fb..f740e6a4 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -1,34 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- Organizátoři - - ``o-nas/organizatori/`` (organizatori) :class:`~seminar.views.views_all.CojemamOrganizatoriView` - - ``o-nas/organizatori/organizovali/`` (stari_organizatori) :class:`~seminar.views.views_all.CojemamOrganizatoriStariView` -- Archiv - - ``archiv/rocniky/`` (seminar_archiv_rocniky) :class:`~seminar.views.views_all.ArchivView` - - ``archiv/temata/`` (seminar_archiv_temata) :class:`~seminar.views.views_all.ArchivTemataView` - - ``rocnik//`` (seminar_rocnik) :class:`~seminar.views.views_all.RocnikView` - - ``cislo/./`` (seminar_cislo) :class:`~seminar.views.views_all.CisloView` - - ``problem//`` (seminar_problem) :func:`~seminar.views.views_all.problemView` -- Zadání - - ``aktualni/zadani/`` (seminar_aktualni_zadani) :func:`~seminar.views.views_all.AktualniZadaniView` - - ``aktualni/vysledkova-listina/`` (seminar_aktualni_vysledky) :func:`~seminar.views.views_all.ZadaniAktualniVysledkovkaView` - - ``aktualni/rocnik/`` (seminar_aktualni_rocnik) :class:`~seminar.views.views_all.AktualniRocnikRedirectView` -- Články - - ``archiv/clanky/`` (clanky_resitel) :class:`~seminar.views.views_all.ClankyResitelView` -- Orgovské stránky - - ``rocnik//vysledkovka.tex`` (seminar_rocnik_vysledkovka) :class:`~seminar.views.views_all.RocnikVysledkovkaView` - - ``rocnik//resitele.csv`` (seminar_rocnik_resitele_csv) :func:`~seminar.views.views_all.resiteleRocnikuCsvExportView` - - ``cislo/./vysledkovka.tex`` (seminar_cislo_vysledkovka) :class:`~seminar.views.views_all.CisloVysledkovkaView` - - ``cislo/./obalky.pdf`` (seminar_cislo_obalky) :func:`~seminar.views.views_all.cisloObalkyView` - - ``cislo/./tituly.tex`` (seminar_cislo_titul) :func:`~seminar.views.views_all.TitulyView` - - ``stav`` (stav_databaze) :func:`~seminar.views.views_all.StavDatabazeView` - - ``cislo/./odmeny/./`` (seminar_archiv_odmeny) :class:`~seminar.views.views_all.OdmenyView` -- Další - - `` `` (titulni_strana) :class:`~seminar.views.views_all.TitulniStranaView` - - ``jak-resit/`` (jak_resit) :class:`~seminar.views.views_all.JakResitView` - - ``stare-novinky/`` (stare_novinky) :class:`~seminar.views.views_all.StareNovinkyView` -""" from django.urls import path, include, re_path from . import views from .utils import org_required diff --git a/seminar/utils.py b/seminar/utils.py index 891f8c15..c826bf0b 100644 --- a/seminar/utils.py +++ b/seminar/utils.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- - import datetime import decimal from django.contrib.auth import get_user_model from django.contrib.auth.decorators import permission_required, \ user_passes_test -from html.parser import HTMLParser from django import views as DjangoViews from django.db import transaction @@ -55,16 +52,6 @@ def inverze_vzorecku_na_prepocet(body: decimal.Decimal, resitelu) -> decimal.Dec return round(body * (resitelu + 2) / 3, 1) -class FirstTagParser(HTMLParser): - def __init__(self, *args, **kwargs): - self.firstTag = None - super().__init__(*args, **kwargs) - - def handle_data(self, data): - if self.firstTag == None: - self.firstTag = data - - def histogram(seznam): d = {} for i in seznam: @@ -337,7 +324,7 @@ def merge_osoby(cilova, zdrojova): # ID, User neřešíme, poznámku vyřešíme separátně. fieldy = ['datum_narozeni', 'datum_registrace', 'datum_souhlasu_udaje', 'datum_souhlasu_zasilani', 'email', 'foto', 'jmeno', 'mesto', - 'pohlavi_muz', 'prezdivka', 'prijmeni', 'psc', 'stat', 'telefon', 'ulice'] + 'osloveni', 'prezdivka', 'prijmeni', 'psc', 'stat', 'telefon', 'ulice'] for f in fieldy: zf = getattr(zdrojova, f) cf = getattr(cilova, f) diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 662c5025..31cfbe17 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -674,8 +674,8 @@ class ClankyResitelView(generic.ListView): def StavDatabazeView(request): # nastaveni = Nastaveni.objects.get() problemy = utils.seznam_problemu() - muzi = Resitel.objects.filter(osoba__pohlavi_muz=True) - zeny = Resitel.objects.filter(osoba__pohlavi_muz=False) + muzi = Resitel.objects.filter(osoba__osloveni=m.Osoba.OSLOVENI_MUZSKE) + zeny = Resitel.objects.filter(osoba__osloveni=m.Osoba.OSLOVENI_ZENSKE) return render(request, 'seminar/stav_databaze.html', { # 'nastaveni': nastaveni, diff --git a/setup/nginx/mam-test.ks.matfyz.cz b/setup/nginx/mam-test.ks.matfyz.cz index 46f9b2ec..90838840 100644 --- a/setup/nginx/mam-test.ks.matfyz.cz +++ b/setup/nginx/mam-test.ks.matfyz.cz @@ -7,11 +7,10 @@ server { } server { # SSL configuration - listen 195.113.20.177:443 ssl; - listen [2001:718:1e03:801::b1]:443 ssl; + listen 195.113.20.177:443 ssl http2; + listen [2001:718:1e03:801::b1]:443 ssl http2; # SSL keys - ssl on; ssl_certificate /etc/letsencrypt/live/mam-test.ks.matfyz.cz/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/mam-test.ks.matfyz.cz/privkey.pem; # managed by Certbot ssl_dhparam /etc/ssl/dhparams.pem; @@ -33,6 +32,10 @@ server { root /akce/mam/www/mamweb-test/; } + location /docs { + alias /akce/mam/www/mamweb-test/docs/_build/html/; + } + location /aesop-export/ { auth_basic "AESOP API"; auth_basic_user_file /akce/mam/www/mamweb-test/.htpasswd-aesop; diff --git a/setup/nginx/mam.mff.cuni.cz b/setup/nginx/mam.mff.cuni.cz index 99292a67..5e5ed681 100644 --- a/setup/nginx/mam.mff.cuni.cz +++ b/setup/nginx/mam.mff.cuni.cz @@ -9,11 +9,10 @@ server { server { # SSL configuration # - listen 195.113.20.177:443 ssl; - listen [2001:718:1e03:801::b1]:443 ssl; + listen 195.113.20.177:443 ssl http2; + listen [2001:718:1e03:801::b1]:443 ssl http2; # SSL keys - ssl on; ssl_certificate /etc/ssl/domains/mam.mff.cuni.cz/bundle.pem; ssl_certificate_key /etc/ssl/domains/mam.mff.cuni.cz/privkey.pem; ssl_dhparam /etc/ssl/dhparams.pem; @@ -49,6 +48,7 @@ server { sub_filter 'href="/' 'href="/wiki/'; sub_filter 'src="/' 'src="/wiki/'; sub_filter 'action="/' 'action="/wiki/'; + sub_filter 'diffurl="/' 'diffurl="/wiki/'; # Overkill: #sub_filter '="/' '="/wiki/'; #sub_filter ':5001/' '/wiki/'; diff --git a/sifrovacka/admin.py b/sifrovacka/admin.py index 5099c241..ff980cd9 100644 --- a/sifrovacka/admin.py +++ b/sifrovacka/admin.py @@ -2,8 +2,6 @@ from django.contrib import admin from .models import OdpovedUcastnika, SpravnaOdpoved, NapovezenoUcastnikovi, Napoveda -# Register your models here. - admin.site.register(OdpovedUcastnika) admin.site.register(SpravnaOdpoved) admin.site.register(Napoveda) diff --git a/sifrovacka/apps.py b/sifrovacka/apps.py index e9f34de6..edca3802 100644 --- a/sifrovacka/apps.py +++ b/sifrovacka/apps.py @@ -3,3 +3,4 @@ from django.apps import AppConfig class SifrovackaConfig(AppConfig): name = 'sifrovacka' + verbose_name = 'Šifrovačka' diff --git a/sifrovacka/models.py b/sifrovacka/models.py index 49565252..cd71fd15 100644 --- a/sifrovacka/models.py +++ b/sifrovacka/models.py @@ -4,9 +4,6 @@ from django.utils import timezone from personalni.models import Resitel -# Create your models here. - - class OdpovedUcastnika(models.Model): class Meta: ordering = ["-timestamp"] diff --git a/sifrovacka/views.py b/sifrovacka/views.py index 2ad352da..0bfa994f 100644 --- a/sifrovacka/views.py +++ b/sifrovacka/views.py @@ -7,8 +7,6 @@ from .models import OdpovedUcastnika, SpravnaOdpoved, Napoveda, NapovezenoUcastn from personalni.models import Resitel -# Create your views here. - class SifrovackaView(FormView): template_name = 'sifrovacka/sifrovacka.html' form_class = SifrovackaForm diff --git a/soustredeni/apps.py b/soustredeni/apps.py index a0a8dae5..90e25f5b 100644 --- a/soustredeni/apps.py +++ b/soustredeni/apps.py @@ -1,8 +1,6 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig class SoustredeniConfig(AppConfig): name = 'soustredeni' + verbose_name = 'Soustředění' diff --git a/soustredeni/models.py b/soustredeni/models.py index 78582565..f71e6736 100644 --- a/soustredeni/models.py +++ b/soustredeni/models.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import logging import os @@ -78,6 +77,10 @@ class Soustredeni(SeminarModelBase): #return reverse('seminar_soustredeni', kwargs={'pk': self.id}) return reverse('seminar_seznam_soustredeni') + def admin_url(self): + model_name = self.__class__.__name__.lower() + return reverse('admin:soustredeni_{}_change'.format(model_name), args=(self.id, )) + @reversion.register(ignore_duplicates=True) class Soustredeni_Ucastnici(SeminarModelBase): diff --git a/soustredeni/templates/soustredeni/export_do_abstraktu.html b/soustredeni/templates/soustredeni/export_do_abstraktu.html new file mode 100644 index 00000000..16de19a0 --- /dev/null +++ b/soustredeni/templates/soustredeni/export_do_abstraktu.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load tex %} + +{% block nadpis1a %} + Soustředění – export do abstraktů +{% endblock %} + +{% block content %} +

        Export do abstraktů Soustředění {{ soustredeni }}

        + +{# Zde zcela záměrně chybí nějaké whitespacy, např. odřádkování a odsazení #} +
        {% for ucastnik in soustredeni.ucastnici.all %}\ucastnik{{ ucastnik|sloz }}{{ ucastnik.osoba.email|sloz }}{{ ucastnik.skola|sloz }}
        +{% endfor %}
        +{% for vedouci in soustredeni.organizatori.all %}\vedouci{{ vedouci|sloz }}{{ vedouci.osoba.email|sloz }}{TODO}
        +{% endfor %}
        + +{% endblock %} diff --git a/soustredeni/templates/soustredeni/seznam_soustredeni.html b/soustredeni/templates/soustredeni/seznam_soustredeni.html index e5f68bfc..ac33852a 100644 --- a/soustredeni/templates/soustredeni/seznam_soustredeni.html +++ b/soustredeni/templates/soustredeni/seznam_soustredeni.html @@ -40,6 +40,7 @@
        Vytvořit novou fotogalerii
        Vygenerovat obálky pro účastníky
        + Vygenerovat účastníky a vedoucí do abstraktů
        Seznam účastníků - HTML tabulka pro tisk, CSV, diff --git a/soustredeni/urls.py b/soustredeni/urls.py index 2e5a6136..6d8de5e1 100644 --- a/soustredeni/urls.py +++ b/soustredeni/urls.py @@ -33,6 +33,11 @@ urlpatterns = [ org_required(views.soustredeniObalkyView), name='seminar_soustredeni_obalky' ), + path( + 'soustredeni//abstrakty', + org_required(views.SoustredeniAbstraktyView.as_view()), + name='seminar_soustredeni_abstrakty' + ), path( 'soustredeni//fotogalerie/', include('galerie.urls') diff --git a/soustredeni/views.py b/soustredeni/views.py index f150b6b8..c7e17d24 100644 --- a/soustredeni/views.py +++ b/soustredeni/views.py @@ -99,3 +99,7 @@ def soustredeniStvrzenkyView(request, soustredeni): with open(tempdir / "stvrzenky.pdf", "rb") as pdffile: response = HttpResponse(pdffile.read(), content_type='application/pdf') return response + +class SoustredeniAbstraktyView(generic.DetailView): + model = Soustredeni + template_name = 'soustredeni/export_do_abstraktu.html' diff --git a/split-apps-meta/other b/split-apps-meta/other new file mode 100644 index 00000000..68d320e2 --- /dev/null +++ b/split-apps-meta/other @@ -0,0 +1,6 @@ +admin +práva +aplikovat práva +orgorozcestník a další reverzované urls + +výhledově smazat ze seminare diff --git a/treenode/apps.py b/treenode/apps.py index 8e7df6fc..5a04a618 100644 --- a/treenode/apps.py +++ b/treenode/apps.py @@ -1,8 +1,6 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig class TreenodeConfig(AppConfig): name = 'treenode' + verbose_name = 'TreeNody' diff --git a/treenode/urls.py b/treenode/urls.py index 1b6444bb..60dc88ad 100644 --- a/treenode/urls.py +++ b/treenode/urls.py @@ -1,8 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- Zatím tu nic moc není… -""" from django.urls import path, re_path from . import views diff --git a/various/admin.py b/various/admin.py index 8c38f3f3..694323fa 100644 --- a/various/admin.py +++ b/various/admin.py @@ -1,3 +1 @@ from django.contrib import admin - -# Register your models here. diff --git a/various/apps.py b/various/apps.py index bf6023f0..751fe3a6 100644 --- a/various/apps.py +++ b/various/apps.py @@ -1,8 +1,6 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig class VariousConfig(AppConfig): name = 'various' + verbose_name = 'Různé' diff --git a/various/autentizace/forms.py b/various/autentizace/forms.py index f3138d74..bf1ab597 100644 --- a/various/autentizace/forms.py +++ b/various/autentizace/forms.py @@ -1,14 +1,3 @@ -""" -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 diff --git a/various/autentizace/urls.py b/various/autentizace/urls.py index a89ff89e..83c8e50e 100644 --- a/various/autentizace/urls.py +++ b/various/autentizace/urls.py @@ -1,16 +1,3 @@ -""" -Soubor sloužící jako „router“, tj. zde se definují url adresy a na co ukazují: - -- ``prihlasit/`` (login) :class:`~various.autentizace.views.LoginView` -- ``login/`` :class:`django.views.generic.base.RedirectView` předchozího -- ``odhlasit/`` (logout) :class:`~various.autentizace.views.LogoutView` -- ``logout/`` :class:`django.views.generic.base.RedirectView` předchozího -- ``reset-hesla/`` (reset_password) :class:`~various.autentizace.views.PasswordResetView` -- ``zmena-hesla/`` (change_password) :class:`~various.autentizace.views.PasswordChangeView` -- ``zmena-hesla/2/`` (reset_password_done) :class:`~various.autentizace.views.PasswordResetDoneView` -- ``reset-hesla/potvrzeni///`` (reset_password_confirm) :class:`~various.autentizace.views.PasswordResetConfirmView` -- ``reset-hesla/hotovo/`` (reset_password_complete) :class:`~various.autentizace.views.PasswordResetCompleteView` -""" from django.urls import path from . import views from django.views.generic.base import RedirectView diff --git a/various/views.py b/various/views.py index 96d9a29d..e344ff26 100644 --- a/various/views.py +++ b/various/views.py @@ -1,8 +1,6 @@ from django.http import HttpResponseForbidden from django.shortcuts import render -# Create your views here. - def csrf_error(request, reason=""): """ Jednoduchý „template view“ (třída to být nemůže) pro CSRF chyby """ diff --git a/vyroci/admin.py b/vyroci/admin.py index 7bf94bef..61476d24 100644 --- a/vyroci/admin.py +++ b/vyroci/admin.py @@ -2,6 +2,4 @@ from django.contrib import admin from .models import UcastnikVyroci -# Register your models here. - admin.site.register(UcastnikVyroci) diff --git a/vyroci/apps.py b/vyroci/apps.py index b30f5d73..0fb1491e 100644 --- a/vyroci/apps.py +++ b/vyroci/apps.py @@ -3,3 +3,4 @@ from django.apps import AppConfig class VyrociConfig(AppConfig): name = 'vyroci' + verbose_name = '30. výročí M&M' diff --git a/vyroci/models.py b/vyroci/models.py index 04fd2097..28e0206a 100644 --- a/vyroci/models.py +++ b/vyroci/models.py @@ -1,7 +1,5 @@ from django.db import models -# Create your models here. - class UcastnikVyroci(models.Model): diff --git a/vyroci/views.py b/vyroci/views.py index a2f4767d..207ed619 100644 --- a/vyroci/views.py +++ b/vyroci/views.py @@ -6,8 +6,6 @@ from .forms import UcastnikVyrociForm from .models import UcastnikVyroci -# Create your views here. - class VyrociView(FormView): template_name = 'vyroci/vyroci.html' form_class = UcastnikVyrociForm diff --git a/vysledkovky/apps.py b/vysledkovky/apps.py index de1c2bde..ef946395 100644 --- a/vysledkovky/apps.py +++ b/vysledkovky/apps.py @@ -1,8 +1,6 @@ -""" -Soubor sloužící k pojmenování a jiným nastavením djangovské aplikace. -""" from django.apps import AppConfig class VysledkovkyConfig(AppConfig): name = 'vysledkovky' + verbose_name = 'Výsledkovky'