Simplify submission admin

This commit is contained in:
cuom1999 2023-08-04 20:19:42 +07:00
parent 4ceae6d066
commit abe5b5eb92

View file

@ -194,13 +194,6 @@ class SubmissionAdmin(admin.ModelAdmin):
def has_add_permission(self, request): def has_add_permission(self, request):
return False return False
def has_change_permission(self, request, obj=None):
if not request.user.has_perm("judge.edit_own_problem"):
return False
if request.user.has_perm("judge.edit_all_problem") or obj is None:
return True
return obj.problem.is_editor(request.profile)
def lookup_allowed(self, key, value): def lookup_allowed(self, key, value):
return super(SubmissionAdmin, self).lookup_allowed(key, value) or key in ( return super(SubmissionAdmin, self).lookup_allowed(key, value) or key in (
"problem__code", "problem__code",