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,8 +166,12 @@ class Profile(models.Model):
|
||||||
remove_contest.alters_data = True
|
remove_contest.alters_data = True
|
||||||
|
|
||||||
def update_contest(self):
|
def update_contest(self):
|
||||||
contest = self.current_contest
|
from judge.models import ContestParticipation
|
||||||
if contest is not None and (contest.ended or not contest.contest.is_accessible_by(self.user)):
|
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()
|
self.remove_contest()
|
||||||
|
|
||||||
update_contest.alters_data = True
|
update_contest.alters_data = True
|
||||||
|
|
Loading…
Reference in a new issue