Add try except for update contest
This commit is contained in:
parent
fea5e46cda
commit
2cd0f0385d
1 changed files with 6 additions and 2 deletions
|
@ -166,9 +166,13 @@ class Profile(models.Model):
|
|||
remove_contest.alters_data = True
|
||||
|
||||
def update_contest(self):
|
||||
from judge.models import ContestParticipation
|
||||
try:
|
||||
contest = self.current_contest
|
||||
if contest is not None and (contest.ended or not contest.contest.is_accessible_by(self.user)):
|
||||
self.remove_contest()
|
||||
except ContestParticipation.DoesNotExist:
|
||||
self.remove_contest()
|
||||
|
||||
update_contest.alters_data = True
|
||||
|
||||
|
|
Loading…
Reference in a new issue