1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-03 20:02:49 +02:00

Upload syntheses

This commit is contained in:
Yohann D'ANELLO
2021-01-14 17:26:08 +01:00
parent 6f26b24359
commit c8780a6d9d
8 changed files with 110 additions and 20 deletions

View File

@ -404,8 +404,8 @@ def get_solution_filename(instance, filename):
+ ("final" if instance.final_solution else "")
def get_random_synthesis_filename(instance, filename):
return "syntheses/" + get_random_string(64)
def get_synthesis_filename(instance, filename):
return f"syntheses/{instance.participation.team.trigram}_{instance.type}_{instance.passage.pk}"
class Solution(models.Model):
@ -469,12 +469,15 @@ class Synthesis(models.Model):
file = models.FileField(
verbose_name=_("file"),
upload_to=get_random_synthesis_filename,
upload_to=get_synthesis_filename,
unique=True,
blank=True,
default="",
)
def __str__(self):
return _("Synthesis for the {type} of the {passage}").format(type=self.get_type_display(), passage=self.passage)
class Meta:
verbose_name = _("synthesis")
verbose_name_plural = _("syntheses")