diff --git a/api/tests/test_skola_autocomplete.py b/api/tests/test_skola_autocomplete.py index 75019983..f5bf420a 100644 --- a/api/tests/test_skola_autocomplete.py +++ b/api/tests/test_skola_autocomplete.py @@ -1,6 +1,6 @@ from django.test import TestCase, tag from django.urls import reverse -import seminar.models as m +from personalni.models import Skola from personalni.utils import sync_skoly @tag('stejny-model-na-produkci') @@ -48,7 +48,7 @@ class OrgSkolyAutocompleteTestCase(TestCase): """Testuje, že pro každého orga je jeho škola ve výsledném QuerySetu""" for pfx, id in self.spravna_data: with self.subTest(prefix=pfx, spravne_id=id): - spravna_skola = m.Skola.objects.get(id=id) + spravna_skola = Skola.objects.get(id=id) # Zeptáme se view, co si myslí resp = self.client.get(reverse('autocomplete_skola')+'?q='+pfx).json() ids = [int(x['id']) for x in resp['results']] diff --git a/api/views/exports.py b/api/views/exports.py index 5c1d57af..1545c2bc 100644 --- a/api/views/exports.py +++ b/api/views/exports.py @@ -1,4 +1,4 @@ -import seminar.models as m +import personalni.models as m from django.core import serializers as ser from django.http import HttpResponse def exportSkolView(request): diff --git a/galerie/views.py b/galerie/views.py index 872bb46e..cf9ade8b 100644 --- a/galerie/views.py +++ b/galerie/views.py @@ -6,7 +6,7 @@ from django.template import RequestContext from datetime import datetime from galerie.models import Obrazek, Galerie -from seminar.models import Soustredeni +from soustredeni.models import Soustredeni from galerie.forms import KomentarForm, NewGalerieForm def zobrazit(galerie, request): diff --git a/novinky/templates/novinky/novinky.html b/novinky/templates/novinky/novinky.html index 535349a5..59f9377b 100644 --- a/novinky/templates/novinky/novinky.html +++ b/novinky/templates/novinky/novinky.html @@ -4,7 +4,7 @@ {% if not novinka.zverejneno and user.je_org %}
{% endif %} {% if novinka.zverejneno or user.je_org %} diff --git a/odevzdavatko/admin.py b/odevzdavatko/admin.py index 6048eb36..b789e3c5 100644 --- a/odevzdavatko/admin.py +++ b/odevzdavatko/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin from django_reverse_admin import ReverseModelAdmin -import seminar.models as m +import odevzdavatko.models as m class PrilohaReseniInline(admin.TabularInline): diff --git a/odevzdavatko/forms.py b/odevzdavatko/forms.py index 583523e3..0ba86654 100644 --- a/odevzdavatko/forms.py +++ b/odevzdavatko/forms.py @@ -4,7 +4,7 @@ from django.forms import formset_factory from django.forms.models import inlineformset_factory from django.utils import timezone -from seminar.models import Resitel +from personalni.models import Resitel import seminar.models as m import logging diff --git a/odevzdavatko/templatetags/barvy_reseni.py b/odevzdavatko/templatetags/barvy_reseni.py index 5a3791fd..f0324ad9 100644 --- a/odevzdavatko/templatetags/barvy_reseni.py +++ b/odevzdavatko/templatetags/barvy_reseni.py @@ -2,11 +2,11 @@ from django import template register = template.Library() from functools import cache -import seminar.models as m +from odevzdavatko.models import Reseni @register.filter @cache -def barva_reseni(r: m.Reseni): +def barva_reseni(r: Reseni): """Vrátí nějakou barvu pro daný problém, ve tvaru '#RRGGBB' Efektivně hešujeme do barev.""" diff --git a/odevzdavatko/templatetags/jmena.py b/odevzdavatko/templatetags/jmena.py index 9fe91ff5..9a08acaa 100644 --- a/odevzdavatko/templatetags/jmena.py +++ b/odevzdavatko/templatetags/jmena.py @@ -2,8 +2,8 @@ from django import template register = template.Library() from personalni.utils import normalizuj_jmeno -import seminar.models as m # jen kvůli typové anotaci… +from personalni.models import Osoba # jen kvůli typové anotaci… @register.filter -def jmeno_jako_prefix(o: m.Osoba): +def jmeno_jako_prefix(o: Osoba): return normalizuj_jmeno(o).replace(' ', '_') diff --git a/personalni/admin.py b/personalni/admin.py index 3418769a..f940ca4a 100644 --- a/personalni/admin.py +++ b/personalni/admin.py @@ -2,7 +2,7 @@ from django.contrib import admin from django.contrib.auth.models import Group from django_reverse_admin import ReverseModelAdmin from django.contrib.messages import WARNING, ERROR, SUCCESS -import seminar.models as m +import personalni.models as m from datetime import datetime @admin.action(description="Sjednoť telefony") diff --git a/personalni/forms.py b/personalni/forms.py index ea0891e7..57e1b398 100644 --- a/personalni/forms.py +++ b/personalni/forms.py @@ -4,7 +4,7 @@ from django.contrib.auth.forms import PasswordResetForm from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.models import User -from seminar.models import Skola, Resitel, Osoba +from personalni.models import Skola, Resitel, Osoba from datetime import date import logging diff --git a/personalni/tests.py b/personalni/tests.py index 31aac8e8..a73d7863 100644 --- a/personalni/tests.py +++ b/personalni/tests.py @@ -4,7 +4,7 @@ from django.contrib.auth.models import User, Group from django.contrib.admin.sites import AdminSite from personalni.admin import OsobaAdmin # Tohle bude peklo, až jednou ty modely fakt rozstřelíme… Možná vyrobit various.all_models, které půjdou importovat jako m? :-) -import seminar.models as m +import personalni.models as m import logging logger = logging.getLogger(__name__) diff --git a/personalni/utils.py b/personalni/utils.py index 4aac1e28..02e541da 100644 --- a/personalni/utils.py +++ b/personalni/utils.py @@ -1,4 +1,3 @@ -import seminar.models as m from various.utils import bez_diakritiky_translate import re @@ -7,9 +6,10 @@ from django.contrib.auth.decorators import permission_required, user_passes_test from django.contrib.auth.models import AnonymousUser from django.db import transaction -import seminar.models as m import soustredeni.models +from odevzdavatko.models import Reseni_Resitele + from .models import Osoba, Organizator, Skola, Resitel, Prijemce @@ -97,7 +97,7 @@ def merge_resitele(cilovy, zdrojovy): # Přepojit všechny vazby ze zdrojového na cílového print('Přepojuji vazby') # Vazby: Škola (hotovo), Řešení_Řešitelé, Konfery_Účastníci, Soustředění_Účastníci, Osoba (vyřeší se později, nejde přepojit) - ct = m.Reseni_Resitele.objects.filter(resitele=zdrojovy).update(resitele=cilovy) + ct = Reseni_Resitele.objects.filter(resitele=zdrojovy).update(resitele=cilovy) print(f' Přepojeno {ct} řešení') ct = soustredeni.models.Konfery_Ucastnici.objects.filter(resitel=zdrojovy).update(resitel=cilovy) print(f' Přepojeno {ct} konfer') diff --git a/personalni/views.py b/personalni/views.py index 12768c34..d994974d 100644 --- a/personalni/views.py +++ b/personalni/views.py @@ -17,7 +17,9 @@ from django.http import HttpResponse from django.utils import timezone import seminar.models as s -import seminar.models as m +import personalni.models as m +from soustredeni.models import Soustredeni +from odevzdavatko.models import Hodnoceni from .forms import PrihlaskaForm, ProfileEditForm, PoMaturiteProfileEditForm from datetime import date @@ -91,7 +93,7 @@ class OrgoRozcestnikView(TemplateView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['posledni_soustredeni'] = s.Soustredeni.objects.order_by('-datum_konce').first() + context['posledni_soustredeni'] = Soustredeni.objects.order_by('-datum_konce').first() nastaveni = s.Nastaveni.objects.first() aktualni_rocnik = nastaveni.aktualni_rocnik context['posledni_cislo_url'] = nastaveni.aktualni_cislo.verejne_url() @@ -99,14 +101,14 @@ class OrgoRozcestnikView(TemplateView): # pokud nechceme haluzit kód (= poradi) dalšího čísla, bude asi potřeba jít # přes treenody (a dát si přitom pozor na MezicisloNode) - neobodovana_reseni = s.Hodnoceni.objects.filter(body__isnull=True) - reseni_mimo_cislo = s.Hodnoceni.objects.filter(deadline_body__isnull=True) + neobodovana_reseni = Hodnoceni.objects.filter(body__isnull=True) + reseni_mimo_cislo = Hodnoceni.objects.filter(deadline_body__isnull=True) context['pocet_neobodovanych_reseni'] = neobodovana_reseni.count() context['pocet_reseni_mimo_cislo'] = reseni_mimo_cislo.count() u = self.request.user - os = s.Osoba.objects.get(user=u) - organizator = s.Organizator.objects.get(osoba=os) + os = m.Osoba.objects.get(user=u) + organizator = m.Organizator.objects.get(osoba=os) context['muj_pocet_neobodovanych_reseni'] = neobodovana_reseni.filter(Q(problem__garant=organizator) | Q(problem__autor=organizator) | Q(problem__opravovatele__in=[organizator])).distinct().count() context['muj_pocet_reseni_mimo_cislo'] = reseni_mimo_cislo.filter(Q(problem__garant=organizator) | Q(problem__autor=organizator) | Q(problem__opravovatele__in=[organizator])).count() @@ -134,12 +136,12 @@ class OrgoRozcestnikView(TemplateView): class ResitelView(LoginRequiredMixin,generic.DetailView): - model = s.Resitel + model = m.Resitel template_name = 'personalni/profil/resitel.html' def get_object(self, queryset=None): print(self.request.user) - return s.Resitel.objects.get(osoba__user=self.request.user) + return m.Resitel.objects.get(osoba__user=self.request.user) ### Formulare @@ -160,7 +162,7 @@ def resitelEditView(request): err_logger = logging.getLogger('seminar.prihlaska.problem') ## Načtení objektů Osoba a Resitel patřících k aktuálně přihlášenému uživateli u = request.user - osoba_edit = s.Osoba.objects.get(user=u) + osoba_edit = m.Osoba.objects.get(user=u) if hasattr(osoba_edit,'resitel'): resitel_edit = osoba_edit.resitel else: @@ -266,7 +268,7 @@ def prihlaskaView(request): resitel_grp = Group.objects.filter(name__exact='resitel').first() u.groups.add(resitel_grp) - o = s.Osoba( + o = m.Osoba( jmeno = fcd['jmeno'], prijmeni = fcd['prijmeni'], osloveni = fcd['osloveni'], @@ -328,7 +330,7 @@ def prihlaskaView(request): if kolize.count() > 1: # Jednu z nich jsme právě uložili err_logger.warning(f'Zaregistrovala se osoba s kolizním jménem. ID osob: {[o.id for o in kolize]}') - r = s.Resitel( + r = m.Resitel( prezdivka_resitele=fcd['prezdivka_resitele'] if fcd['prezdivka_resitele'] != "" else None, rok_maturity = fcd['rok_maturity'], zasilat = fcd['zasilat'], diff --git a/prednasky/admin.py b/prednasky/admin.py index d086cd0c..19eace7f 100644 --- a/prednasky/admin.py +++ b/prednasky/admin.py @@ -5,7 +5,7 @@ from django.utils.safestring import mark_safe from django.utils.html import escape from .models import Prednaska, Seznam, STAV_NAVRH -from seminar.models import Soustredeni +from soustredeni.models import Soustredeni class Seznam_PrednaskaInline(admin.TabularInline): diff --git a/prednasky/views.py b/prednasky/views.py index 699b690d..368c98d9 100644 --- a/prednasky/views.py +++ b/prednasky/views.py @@ -6,7 +6,8 @@ from django.db.models import Sum from django.forms import Form from prednasky.models import Prednaska, Hlasovani, Seznam, STAV_NAVRH -from seminar.models import Soustredeni, Osoba +from soustredeni.models import Soustredeni +from personalni.models import Osoba def newPrednaska(request): # hlasovani se vztahuje k nejnovejsimu soustredeni diff --git a/treenode/templates/treenode/treenode_recursive.html b/treenode/templates/treenode/treenode_recursive.html index 6da7a96f..4a54f41f 100644 --- a/treenode/templates/treenode/treenode_recursive.html +++ b/treenode/templates/treenode/treenode_recursive.html @@ -25,20 +25,20 @@ - nejsou testovací data
{% endif %} -{% include "seminar/treenode_name.html" %} +{% include "treenode/treenode_name.html" %} {%if obj.children %}
- {% with kam="před" kam_slug="syn" %} {% include "seminar/treenode_add_stub.html" %} {% endwith %} + {% with kam="před" kam_slug="syn" %} {% include "treenode/treenode_add_stub.html" %} {% endwith %} {%for ch in obj.children %} {# ----------- Vypisujeme podstrom ----------#} - {%with obj=ch depth=depth|add:"1" %} {%include "seminar/treenode_recursive.html" %} {%endwith%} + {%with obj=ch depth=depth|add:"1" %} {%include "treenode/treenode_recursive.html" %} {%endwith%} {# ----------- Přidáváme mezi syny / za posledního -------- #} {% if forloop.last %} - {% with kam="za" kam_slug="za" obj=ch %} {% include "seminar/treenode_add_stub.html" %} {% endwith %} + {% with kam="za" kam_slug="za" obj=ch %} {% include "treenode/treenode_add_stub.html" %} {% endwith %} {% else %} - {% with kam="mezi" obj=ch kam_slug="za" %} {% include "seminar/treenode_add_stub.html" %} {% endwith %} + {% with kam="mezi" obj=ch kam_slug="za" %} {% include "treenode/treenode_add_stub.html" %} {% endwith %} {% endif %} {# ----------- Prohazujeme sousedy ----------#}
@@ -50,6 +50,6 @@
{% else %} {# ----------- Přidáváme prvního syna ----------#} - {% with kam="jako syna" kam_slug="syn" %} {% include "seminar/treenode_add_stub.html" %} {% endwith %} + {% with kam="jako syna" kam_slug="syn" %} {% include "treenode/treenode_add_stub.html" %} {% endwith %} {%endif%}
diff --git a/tvorba/templates/tvorba/archiv/problem_clanek.html b/tvorba/templates/tvorba/archiv/problem_clanek.html index a59e8b87..f14eeb7f 100644 --- a/tvorba/templates/tvorba/archiv/problem_clanek.html +++ b/tvorba/templates/tvorba/archiv/problem_clanek.html @@ -1,4 +1,4 @@ -{% extends "seminar/archiv/problem.html" %} +{% extends "tvorba/archiv/problem.html" %} {% block problem %} {% if problem.cislo_zadani %} diff --git a/tvorba/templates/tvorba/archiv/problem_tema.html b/tvorba/templates/tvorba/archiv/problem_tema.html index 8bb851ea..322f4200 100644 --- a/tvorba/templates/tvorba/archiv/problem_tema.html +++ b/tvorba/templates/tvorba/archiv/problem_tema.html @@ -1,4 +1,4 @@ -{% extends "seminar/archiv/problem.html" %} +{% extends "tvorba/archiv/problem.html" %} {% block problem %}

diff --git a/tvorba/templates/tvorba/archiv/problem_uloha.html b/tvorba/templates/tvorba/archiv/problem_uloha.html index 9a146389..a9d96479 100644 --- a/tvorba/templates/tvorba/archiv/problem_uloha.html +++ b/tvorba/templates/tvorba/archiv/problem_uloha.html @@ -1,4 +1,4 @@ -{% extends "seminar/archiv/problem.html" %} +{% extends "tvorba/archiv/problem.html" %} {% block problem %}

diff --git a/tvorba/templates/tvorba/archiv/problem_uloha_tema.html b/tvorba/templates/tvorba/archiv/problem_uloha_tema.html index 9a146389..a9d96479 100644 --- a/tvorba/templates/tvorba/archiv/problem_uloha_tema.html +++ b/tvorba/templates/tvorba/archiv/problem_uloha_tema.html @@ -1,4 +1,4 @@ -{% extends "seminar/archiv/problem.html" %} +{% extends "tvorba/archiv/problem.html" %} {% block problem %}

diff --git a/tvorba/templates/tvorba/clanky/organizatorske_clanky.html b/tvorba/templates/tvorba/clanky/organizatorske_clanky.html index a7fb03c9..816daad8 100644 --- a/tvorba/templates/tvorba/clanky/organizatorske_clanky.html +++ b/tvorba/templates/tvorba/clanky/organizatorske_clanky.html @@ -1,4 +1,4 @@ -{% extends 'seminar/clanky/resitelske_clanky.html' %} +{% extends 'tvorba/clanky/resitelske_clanky.html' %} {% block nadpis1a %} Organizátorské články diff --git a/vyroci/views.py b/vyroci/views.py index 455d6e25..9c5b5194 100644 --- a/vyroci/views.py +++ b/vyroci/views.py @@ -1,6 +1,6 @@ from django.views.generic import FormView, ListView -from seminar.models import Osoba +from personalni.models import Osoba from various.views.pomocne import formularOKView from .forms import UcastnikVyrociForm from .models import UcastnikVyroci