diff --git a/judge/admin/problem.py b/judge/admin/problem.py index 3e92e74..3c4e3fc 100644 --- a/judge/admin/problem.py +++ b/judge/admin/problem.py @@ -239,14 +239,26 @@ class ProblemAdmin(VersionAdmin): class ProblemPointsVoteAdmin(admin.ModelAdmin): - list_display = ('points', 'voter', 'problem', 'vote_time') - search_fields = ('voter', 'problem') - readonly_fields = ('voter', 'problem', 'vote_time') + list_display = ('points', 'voter', 'problem', 'problem_code', 'problem_points', 'vote_time') + search_fields = ('voter__user__username', 'problem__code',) + readonly_fields = ('voter', 'problem', 'problem_code', 'problem_points', 'vote_time') def has_change_permission(self, request, obj=None): if obj is None: return request.user.has_perm('judge.edit_own_problem') return obj.problem.is_editable_by(request.user) - def lookup_allowed(self, key, value): - return super().lookup_allowed(key, value) or key in ('problem__code',) \ No newline at end of file + # def lookup_allowed(self, key, value): + # return key in ('problem') + + def problem_code(self, obj): + return obj.problem.code + + problem_code.short_description = 'Problem Code' + problem_code.admin_order_field = 'problem__code' + + def problem_points(self, obj): + return obj.problem.points + + problem_points.short_description = 'Problem Points' + problem_points.admin_order_field = 'problem__points' \ No newline at end of file diff --git a/templates/problem/voting-form.html b/templates/problem/voting-form.html index 0ed939e..735b781 100644 --- a/templates/problem/voting-form.html +++ b/templates/problem/voting-form.html @@ -35,8 +35,8 @@ {{_('This helps us improve the site')}} - {{_('Easy')}} - {{_('Hard')}} + {{min_possible_vote}} + {{max_possible_vote}}