1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-17 02:15:53 +02:00

Send solutions

This commit is contained in:
Yohann D'ANELLO
2020-05-04 23:37:21 +02:00
parent 9499e10524
commit 26eacad2fd
9 changed files with 118 additions and 21 deletions

View File

@ -178,6 +178,10 @@ class Document(PolymorphicModel):
verbose_name = _("document")
verbose_name_plural = _("documents")
def delete(self, *args, **kwargs):
self.file.delete(True)
return super().delete(*args, **kwargs)
class Authorization(Document):
user = models.ForeignKey(
@ -234,14 +238,15 @@ class Solution(Document):
verbose_name=_("problem"),
)
def save(self, **kwargs):
self.type = "solution"
super().save(**kwargs)
final = models.BooleanField(
default=False,
verbose_name=_("final solution"),
)
class Meta:
verbose_name = _("solution")
verbose_name_plural = _("solutions")
unique_together = ('team', 'problem',)
unique_together = ('team', 'problem', 'final',)
def __str__(self):
return _("Solution of team {trigram} for problem {problem}")\
@ -274,13 +279,15 @@ class Synthesis(Document):
verbose_name=_("round"),
)
def save(self, **kwargs):
self.type = "synthesis"
super().save(**kwargs)
final = models.BooleanField(
default=False,
verbose_name=_("final synthesis"),
)
class Meta:
verbose_name = _("synthesis")
verbose_name_plural = _("syntheses")
unique_together = ('team', 'dest', 'round', 'final',)
def __str__(self):
return _("Synthesis of team {trigram} that is {dest} for problem {problem}")\