change e testcase table UI and add CPP validator

This commit is contained in:
cuom1999 2020-03-17 00:11:03 -06:00
parent 0ff312e3ba
commit f74f8b6e05
15 changed files with 803 additions and 181 deletions

View file

@ -30,6 +30,7 @@ CHECKERS = (
('identical', _('Byte identical')),
('linecount', _('Line-by-line')),
('custom', _('Custom checker')),
('customval', _('Custom Validator')),
)
@ -52,6 +53,12 @@ class ProblemData(models.Model):
blank=True,
upload_to=problem_directory_file,
validators=[FileExtensionValidator(allowed_extensions=['py'])])
custom_validator = models.FileField(verbose_name=_('custom validator file'),
storage=problem_data_storage,
null=True,
blank=True,
upload_to=problem_directory_file,
validators=[FileExtensionValidator(allowed_extensions=['cpp'])])
__original_zipfile = None
def __init__(self, *args, **kwargs):
@ -78,6 +85,10 @@ class ProblemData(models.Model):
self.generator.name = _problem_directory_file(new, self.generator.name)
if self.custom_checker:
self.custom_checker.name = _problem_directory_file(new, self.custom_checker.name)
if self.custom_checker:
self.custom_checker.name = _problem_directory_file(new, self.custom_checker.name)
if self.custom_validator:
self.custom_validator.name = _problem_directory_file(new, self.custom_validator.name)
self.save()
_update_code.alters_data = True