Add limit for contest time limit

This commit is contained in:
cuom1999 2024-08-14 19:34:29 +07:00
parent 37cdd2dd04
commit 091c662b3b

View file

@ -375,6 +375,10 @@ class Contest(models.Model, PageVotable, Bookmarkable):
if self.end_time > one_year_later: if self.end_time > one_year_later:
self.end_time = one_year_later self.end_time = one_year_later
max_duration = timedelta(days=7)
if self.time_limit and self.time_limit > max_duration:
self.time_limit = max_duration
super().save(*args, **kwargs) super().save(*args, **kwargs)
def is_in_contest(self, user): def is_in_contest(self, user):