diff --git a/seminar/models/__init__.py b/seminar/models/__init__.py index 912fc3ec..aebbf6c1 100644 --- a/seminar/models/__init__.py +++ b/seminar/models/__init__.py @@ -1,4 +1,3 @@ from .base import * from .pomocne import * -from .treenode import * from .novinky import * diff --git a/seminar/testutils.py b/seminar/testutils.py index 8c772073..d9e636ca 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -19,7 +19,7 @@ from odevzdavatko.models import * from soustredeni.models import * from seminar.models.novinky import * from seminar.models.pomocne import * -from seminar.models.treenode import * +from treenode.models import * from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site diff --git a/seminar/utils.py b/seminar/utils.py index 90504d5a..349b0f01 100644 --- a/seminar/utils.py +++ b/seminar/utils.py @@ -18,7 +18,7 @@ import logging from personalni.models import Organizator, Resitel, Skola, Prijemce from tvorba.models import Clanek, Rocnik -from seminar.models.treenode import CisloNode +from treenode.models import CisloNode from soustredeni.models import Konfery_Ucastnici, Soustredeni_Ucastnici from odevzdavatko.models import Reseni_Resitele import treenode.treelib as t diff --git a/treenode/admin.py b/treenode/admin.py index fefb0bbe..d28d0fd2 100644 --- a/treenode/admin.py +++ b/treenode/admin.py @@ -2,7 +2,7 @@ from django.contrib import admin from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin, PolymorphicChildModelFilter -from seminar.models.treenode import * +from .models import * # Polymorfismus pro stromy # TODO: Inlines podle https://django-polymorphic.readthedocs.io/en/stable/admin.html diff --git a/seminar/models/treenode.py b/treenode/models.py similarity index 99% rename from seminar/models/treenode.py rename to treenode/models.py index ee8f1b68..3080162b 100644 --- a/seminar/models/treenode.py +++ b/treenode/models.py @@ -11,7 +11,7 @@ from polymorphic.models import PolymorphicModel from odevzdavatko.models import Reseni from personalni.models import Organizator -from .pomocne import Text +from seminar.models.pomocne import Text logger = logging.getLogger(__name__) diff --git a/treenode/serializers.py b/treenode/serializers.py index 0bbca115..13ac1e27 100644 --- a/treenode/serializers.py +++ b/treenode/serializers.py @@ -1,7 +1,7 @@ from rest_framework import serializers from rest_polymorphic.serializers import PolymorphicSerializer -from seminar.models.treenode import * +from .models import * from seminar.models.pomocne import Text from odevzdavatko.models import Reseni from tvorba.models import Problem, Uloha diff --git a/treenode/templatetags.py b/treenode/templatetags.py index 1f1db4af..5590a5f7 100644 --- a/treenode/templatetags.py +++ b/treenode/templatetags.py @@ -1,6 +1,6 @@ from django import template from enum import Enum -from seminar.models.treenode import * +from .models import * register = template.Library() diff --git a/treenode/tests.py b/treenode/tests.py index 921e4bd6..c8289735 100644 --- a/treenode/tests.py +++ b/treenode/tests.py @@ -1,6 +1,6 @@ from django.test import TestCase import treenode.treelib as tl -from seminar.models.treenode import * +from .models import * class SimpleTreeLibTests(TestCase): def setUp(self): diff --git a/treenode/treelib.py b/treenode/treelib.py index 29bbd648..5b05a86e 100644 --- a/treenode/treelib.py +++ b/treenode/treelib.py @@ -238,7 +238,7 @@ class TreeLibError(RuntimeError): # Editace stromu: def create_node_after(predecessor, type, **kwargs): - from seminar.models.treenode import TreeNode + from .models import TreeNode if predecessor is None: raise TreeLibError("Nelze vyrábět sirotky! (predecessor=None)") if not issubclass(type, TreeNode): @@ -255,7 +255,7 @@ def create_node_after(predecessor, type, **kwargs): # Vyrábí prvního syna, ostatní nalepí za (existují-li) def create_child(parent, type, **kwargs): - from seminar.models.treenode import TreeNode + from .models import TreeNode if parent is None: raise TreeLibError("Nelze vyrábět sirotky! (parent=None)") if not issubclass(type, TreeNode): @@ -293,7 +293,7 @@ def insert_last_child(parent, node): last.save() def create_node_before(successor, type, **kwargs): - from seminar.models.treenode import TreeNode + from .models import TreeNode if successor is None: raise TreeLibError("Nelze vyrábět sirotky! (successor=None)") if not issubclass(type, TreeNode): diff --git a/treenode/views.py b/treenode/views.py index 8d34d382..dd49416d 100644 --- a/treenode/views.py +++ b/treenode/views.py @@ -6,7 +6,7 @@ from django.views.generic.edit import CreateView from django.contrib.auth.mixins import LoginRequiredMixin from django.core.exceptions import PermissionDenied -from seminar.models.treenode import * +from .models import * from seminar.models.pomocne import Text, Obrazek from treenode import treelib import treenode.forms as f diff --git a/treenode/viewsets.py b/treenode/viewsets.py index 8677d7e1..62d7bbd5 100644 --- a/treenode/viewsets.py +++ b/treenode/viewsets.py @@ -3,7 +3,7 @@ from rest_framework import status from rest_framework.response import Response from django.core.exceptions import PermissionDenied from rest_framework.permissions import BasePermission, AllowAny -from seminar.models.treenode import * +from .models import * from tvorba.models import Problem, Uloha from odevzdavatko.models import Reseni import treenode.serializers as views diff --git a/tvorba/models.py b/tvorba/models.py index ae629418..fd7a62da 100644 --- a/tvorba/models.py +++ b/tvorba/models.py @@ -319,7 +319,7 @@ class Cislo(SeminarModelBase): except ObjectDoesNotExist: # Neexistující *Node nemá smysl aktualizovat, ale je potřeba ho naopak vyrobit logger.warning(f'Číslo {self} nemělo ČísloNode, vyrábím…') - from seminar.models.treenode import CisloNode + from treenode.models import CisloNode CisloNode.objects.create(cislo=self) def zlomovy_deadline_pro_papirove_cislo(self): @@ -583,7 +583,7 @@ class Tema(Problem): def cislo_node(self): tema_node_set = self.temavcislenode_set.all() tema_cisla_vyskyt = [] - from seminar.models.treenode import CisloNode + from treenode.models import CisloNode for tn in tema_node_set: tema_cisla_vyskyt.append( treelib.get_upper_node_of_type(tn, CisloNode).cislo) @@ -664,7 +664,7 @@ class Uloha(Problem): def cislo_node(self): zadani_node = self.ulohazadaninode - from seminar.models.treenode import CisloNode + from treenode.models import CisloNode return treelib.get_upper_node_of_type(zadani_node, CisloNode)