Přesun ReseniNode do treenode

This commit is contained in:
Jonas Havelka 2023-07-31 19:31:23 +02:00
parent 666b455bbd
commit 8c881621b0
5 changed files with 19 additions and 21 deletions

View file

@ -11,7 +11,6 @@ from django.conf import settings
from seminar.models.tvorba import Cislo, Deadline, Problem, Uloha, aux_generate_filename
from seminar.models.personalni import Resitel
from seminar.models.treenode import TreeNode
from seminar.models.base import SeminarModelBase
@ -242,19 +241,3 @@ class Reseni_Resitele(models.Model):
def __str__(self):
return '{} od {}'.format(self.reseni, self.resitel)
# NOTE: Poteciální DB HOG bez select_related
class ReseniNode(TreeNode):
class Meta:
db_table = 'seminar_nodes_otistene_reseni'
verbose_name = 'Otištěné řešení (Node)'
verbose_name_plural = 'Otištěná řešení (Node)'
reseni = models.ForeignKey(Reseni,
on_delete=models.PROTECT,
verbose_name = 'reseni')
def aktualizuj_nazev(self):
self.nazev = "ReseniNode: "+str(self.reseni)
def getOdkazStr(self):
return str(self.reseni)

View file

@ -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 . import personalni as pm
from . import personalni as pm, Reseni
from .pomocne import Text
@ -263,3 +263,19 @@ class CastNode(TreeNode):
def getOdkazStr(self):
return str(self.nadpis)
class ReseniNode(TreeNode):
class Meta:
db_table = 'seminar_nodes_otistene_reseni'
verbose_name = 'Otištěné řešení (Node)'
verbose_name_plural = 'Otištěná řešení (Node)'
reseni = models.ForeignKey(Reseni,
on_delete=models.PROTECT,
verbose_name = 'reseni')
def aktualizuj_nazev(self):
self.nazev = "ReseniNode: "+str(self.reseni)
def getOdkazStr(self):
return str(self.reseni)

View file

@ -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, ReseniNode
from seminar.models.odevzdavatko import Reseni
from seminar.models.tvorba import Problem, Uloha
from treenode import treelib

View file

@ -8,7 +8,6 @@ from django.core.exceptions import PermissionDenied
from seminar.models.treenode import *
from seminar.models.pomocne import Text, Obrazek
from seminar.models.odevzdavatko import ReseniNode
from treenode import treelib
import treenode.forms as f
import treenode.templatetags as tnltt

View file

@ -5,7 +5,7 @@ from django.core.exceptions import PermissionDenied
from rest_framework.permissions import BasePermission, AllowAny
from seminar.models.treenode import *
from seminar.models.tvorba import Problem, Uloha
from seminar.models.odevzdavatko import Reseni, ReseniNode
from seminar.models.odevzdavatko import Reseni
import treenode.serializers as views
from treenode.permissions import AllowWrite