Add IOI signature to UI

This commit is contained in:
cuom1999 2023-08-01 12:26:15 +07:00
parent 220a7e7237
commit 64495be799
9 changed files with 469 additions and 272 deletions

View file

@ -123,6 +123,27 @@ class ProblemData(models.Model):
help_text=_("Support output-only problem"),
null=True,
)
use_ioi_signature = models.BooleanField(
verbose_name=_("is IOI signature"),
help_text=_("Use IOI Signature"),
null=True,
)
signature_handler = models.FileField(
verbose_name=_("signature handler"),
storage=problem_data_storage,
null=True,
blank=True,
upload_to=problem_directory_file,
validators=[FileExtensionValidator(allowed_extensions=["cpp"])],
)
signature_header = models.FileField(
verbose_name=_("signature header"),
storage=problem_data_storage,
null=True,
blank=True,
upload_to=problem_directory_file,
validators=[FileExtensionValidator(allowed_extensions=["h"])],
)
__original_zipfile = None
@ -169,6 +190,18 @@ class ProblemData(models.Model):
self.custom_validator.name = problem_directory_file_helper(
new, self.custom_validator.name
)
if self.interactive_judge:
self.interactive_judge.name = problem_directory_file_helper(
new, self.interactive_judge.name
)
if self.signature_header:
self.signature_header.name = problem_directory_file_helper(
new, self.signature_header.name
)
if self.signature_handler:
self.signature_handler.name = problem_directory_file_helper(
new, self.signature_handler.name
)
self.save()
_update_code.alters_data = True