Update problem vote

This commit is contained in:
cuom1999 2022-03-11 22:34:32 -06:00
parent 77d7244ad2
commit cb7e4559e4
4 changed files with 24 additions and 26 deletions

View file

@ -375,12 +375,13 @@ class Problem(models.Model):
save.alters_data = True
def can_vote(self, user):
def can_vote(self, request):
user = request.user
if not user.is_authenticated:
return False
# If the user is in contest, nothing should be shown.
if user.profile.current_contest:
if request.in_contest_mode:
return False
# If the user is not allowed to vote