From 9b3cbb512c87f698d1928668962750b37e119b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 9 Aug 2023 19:32:55 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99esun=20k=C3=B3du=20model=C5=AF=20odevzd?= =?UTF-8?q?=C3=A1v=C3=A1tka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odevzdavatko/admin.py | 2 +- odevzdavatko/forms.py | 2 +- seminar/models/odevzdavatko.py => odevzdavatko/models.py | 0 odevzdavatko/views.py | 2 +- personalni/models.py | 6 +++--- personalni/views.py | 2 +- seminar/management/commands/testdata.py | 2 +- seminar/migrations/0001_initial.py | 2 +- seminar/migrations/0001_squashed_0098_auto_20210906_0305.py | 2 +- seminar/models/__init__.py | 1 - seminar/models/treenode.py | 2 +- seminar/testutils.py | 2 +- seminar/utils.py | 2 +- treenode/serializers.py | 2 +- treenode/viewsets.py | 2 +- vysledkovky/utils.py | 2 +- 16 files changed, 16 insertions(+), 17 deletions(-) rename seminar/models/odevzdavatko.py => odevzdavatko/models.py (100%) diff --git a/odevzdavatko/admin.py b/odevzdavatko/admin.py index 918d2948..358165c6 100644 --- a/odevzdavatko/admin.py +++ b/odevzdavatko/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin from django_reverse_admin import ReverseModelAdmin -from seminar.models.odevzdavatko import * +from .models import * class PrilohaReseniInline(admin.TabularInline): diff --git a/odevzdavatko/forms.py b/odevzdavatko/forms.py index dcf4f95d..6ac1c403 100644 --- a/odevzdavatko/forms.py +++ b/odevzdavatko/forms.py @@ -7,7 +7,7 @@ from django.utils import timezone from personalni.models import Resitel from tvorba.models import Problem, Deadline from seminar.models.nastaveni import Nastaveni -from seminar.models.odevzdavatko import * +from .models import * import logging diff --git a/seminar/models/odevzdavatko.py b/odevzdavatko/models.py similarity index 100% rename from seminar/models/odevzdavatko.py rename to odevzdavatko/models.py diff --git a/odevzdavatko/views.py b/odevzdavatko/views.py index 87f3be55..27a060fe 100644 --- a/odevzdavatko/views.py +++ b/odevzdavatko/views.py @@ -16,7 +16,7 @@ import datetime from itertools import groupby import logging -from seminar.models.odevzdavatko import * +from .models import * from tvorba.models import Problem, Rocnik, Deadline from seminar.models.nastaveni import Nastaveni from personalni.models import Resitel, Organizator, Osoba diff --git a/personalni/models.py b/personalni/models.py index 6bc62705..54088fec 100644 --- a/personalni/models.py +++ b/personalni/models.py @@ -252,7 +252,7 @@ class Resitel(SeminarModelBase): def vsechny_body(self): "Spočítá body odjakživa." vsechna_reseni = self.reseni_set.all() - from seminar.models.odevzdavatko import Hodnoceni + from odevzdavatko.models import Hodnoceni vsechna_hodnoceni = Hodnoceni.objects.filter( reseni__in=vsechna_reseni) return sum(h.body for h in list(vsechna_hodnoceni) if h.body is not None) @@ -299,7 +299,7 @@ class Resitel(SeminarModelBase): # - body z 25. ročníku a dříve byly shledány dvakrát hodnotnějšími # - proto se započítávají dvojnásobně a byly posunuté hranice titulů # - staré tituly se ale nemají odebrat, pokud řešitel v t.č. minulém (26.) ročníku měl titul, má ho mít pořád. - from seminar.models.odevzdavatko import Hodnoceni + from odevzdavatko.models import Hodnoceni hodnoceni_do_25_rocniku = Hodnoceni.objects.filter(deadline_body__cislo__rocnik__rocnik__lte=25,reseni__in=self.reseni_set.all()) novejsi_hodnoceni = Hodnoceni.objects.filter(reseni__in=self.reseni_set.all()).difference(hodnoceni_do_25_rocniku) @@ -337,7 +337,7 @@ class Resitel(SeminarModelBase): else: return Titul.akad - from seminar.models.odevzdavatko import Hodnoceni + from odevzdavatko.models import Hodnoceni hodnoceni_do_26_rocniku = Hodnoceni.objects.filter(deadline_body__cislo__rocnik__rocnik__lte=26,reseni__in=self.reseni_set.all()) novejsi_body = body_z_hodnoceni( Hodnoceni.objects.filter(reseni__in=self.reseni_set.all()) diff --git a/personalni/views.py b/personalni/views.py index ae42e328..bb170baa 100644 --- a/personalni/views.py +++ b/personalni/views.py @@ -9,7 +9,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.db import transaction from django.http import HttpResponse -from seminar.models.odevzdavatko import Hodnoceni +from odevzdavatko.models import Hodnoceni from .models import * from tvorba.models import Tema, Uloha, Clanek from seminar.models.nastaveni import Nastaveni diff --git a/seminar/management/commands/testdata.py b/seminar/management/commands/testdata.py index f95721ff..4c2727a9 100644 --- a/seminar/management/commands/testdata.py +++ b/seminar/management/commands/testdata.py @@ -9,7 +9,7 @@ from django.conf import settings from personalni.models import Skola, Resitel from tvorba.models import Rocnik, Cislo, Problem -from seminar.models.odevzdavatko import Reseni +from odevzdavatko.models import Reseni from seminar.testutils import create_test_data import django.contrib.auth User = django.contrib.auth.get_user_model() diff --git a/seminar/migrations/0001_initial.py b/seminar/migrations/0001_initial.py index 97fa4bf5..b6ba104f 100644 --- a/seminar/migrations/0001_initial.py +++ b/seminar/migrations/0001_initial.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.db import models, migrations import django_countries.fields -from seminar.models.odevzdavatko import generate_filename +from odevzdavatko.models import generate_filename import django.utils.timezone from django.conf import settings diff --git a/seminar/migrations/0001_squashed_0098_auto_20210906_0305.py b/seminar/migrations/0001_squashed_0098_auto_20210906_0305.py index 8fa575eb..18c237b2 100644 --- a/seminar/migrations/0001_squashed_0098_auto_20210906_0305.py +++ b/seminar/migrations/0001_squashed_0098_auto_20210906_0305.py @@ -7,7 +7,7 @@ import django.db.models.deletion import django.utils.timezone import django_countries.fields import imagekit.models.fields -from seminar.models.odevzdavatko import generate_filename +from odevzdavatko.models import generate_filename from seminar.models.soustredeni import generate_filename_konfera from tvorba.models import cislo_pdf_filename, cislo_png_filename import taggit.managers diff --git a/seminar/models/__init__.py b/seminar/models/__init__.py index 11402ea9..12835703 100644 --- a/seminar/models/__init__.py +++ b/seminar/models/__init__.py @@ -1,4 +1,3 @@ -from .odevzdavatko import * from .base import * from .soustredeni import * from .pomocne import * diff --git a/seminar/models/treenode.py b/seminar/models/treenode.py index a3892322..ee8f1b68 100644 --- a/seminar/models/treenode.py +++ b/seminar/models/treenode.py @@ -8,7 +8,7 @@ from unidecode import unidecode # Používám pro získání ID odkazu (ještě from polymorphic.models import PolymorphicModel -from .odevzdavatko import Reseni +from odevzdavatko.models import Reseni from personalni.models import Organizator from .pomocne import Text diff --git a/seminar/testutils.py b/seminar/testutils.py index 33bc4d1f..6c86fd54 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -15,7 +15,7 @@ from korektury.testutils import create_test_pdf from models.nastaveni import * from personalni.models import * from tvorba.models import * -from seminar.models.odevzdavatko import * +from odevzdavatko.models import * from seminar.models.soustredeni import * from seminar.models.novinky import * from seminar.models.pomocne import * diff --git a/seminar/utils.py b/seminar/utils.py index 5e0447fd..4b605c81 100644 --- a/seminar/utils.py +++ b/seminar/utils.py @@ -20,7 +20,7 @@ from personalni.models import Organizator, Resitel, Skola, Prijemce from tvorba.models import Clanek, Rocnik from seminar.models.treenode import CisloNode from seminar.models.soustredeni import Konfery_Ucastnici, Soustredeni_Ucastnici -from seminar.models.odevzdavatko import Reseni_Resitele +from odevzdavatko.models import Reseni_Resitele import treenode.treelib as t logger = logging.getLogger(__name__) diff --git a/treenode/serializers.py b/treenode/serializers.py index 08adc925..0bbca115 100644 --- a/treenode/serializers.py +++ b/treenode/serializers.py @@ -3,7 +3,7 @@ from rest_polymorphic.serializers import PolymorphicSerializer from seminar.models.treenode import * from seminar.models.pomocne import Text -from seminar.models.odevzdavatko import Reseni +from odevzdavatko.models import Reseni from tvorba.models import Problem, Uloha from treenode import treelib diff --git a/treenode/viewsets.py b/treenode/viewsets.py index 4c78d472..8677d7e1 100644 --- a/treenode/viewsets.py +++ b/treenode/viewsets.py @@ -5,7 +5,7 @@ from django.core.exceptions import PermissionDenied from rest_framework.permissions import BasePermission, AllowAny from seminar.models.treenode import * from tvorba.models import Problem, Uloha -from seminar.models.odevzdavatko import Reseni +from odevzdavatko.models import Reseni import treenode.serializers as views from treenode.permissions import AllowWrite diff --git a/vysledkovky/utils.py b/vysledkovky/utils.py index 15055678..1edaabec 100644 --- a/vysledkovky/utils.py +++ b/vysledkovky/utils.py @@ -3,7 +3,7 @@ from functools import cached_property from typing import Union, Iterable # TODO: s pythonem 3.10 přepsat na '|' from tvorba.models import Rocnik, Cislo, Deadline, Problem, Clanek -from seminar.models.odevzdavatko import Hodnoceni +from odevzdavatko.models import Hodnoceni from personalni.models import Resitel from seminar.models.soustredeni import Konfera from django.db.models import Q, Sum