solutions table
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
from functools import cached_property
|
||||
|
||||
from SprintLib.utils import get_bytes, write_bytes, delete_file
|
||||
|
||||
|
||||
class FileStorageMixin:
|
||||
@property
|
||||
@cached_property
|
||||
def text(self):
|
||||
return get_bytes(self.fs_id).decode("utf-8")
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
from os.path import join, exists
|
||||
from functools import cached_property
|
||||
from os.path import exists
|
||||
from shutil import rmtree
|
||||
from subprocess import call
|
||||
|
||||
@@ -8,7 +9,7 @@ from django.utils import timezone
|
||||
|
||||
from Main.models.solution_file import SolutionFile
|
||||
from Main.models.task import Task
|
||||
from Sprint.settings import CONSTS, SOLUTIONS_ROOT, SOLUTIONS_ROOT_EXTERNAL
|
||||
from Sprint.settings import CONSTS
|
||||
from SprintLib.language import languages
|
||||
|
||||
|
||||
@@ -28,7 +29,7 @@ class Solution(models.Model):
|
||||
rmtree(self.directory)
|
||||
super().delete(using=using, keep_parents=keep_parents)
|
||||
|
||||
@property
|
||||
@cached_property
|
||||
def files(self):
|
||||
data = []
|
||||
for file in SolutionFile.objects.filter(solution=self):
|
||||
|
Reference in New Issue
Block a user