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:
@ -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")
|
||||
|
Reference in New Issue
Block a user