Reformat using black
This commit is contained in:
parent
efee4ad081
commit
a87fb49918
221 changed files with 19127 additions and 7310 deletions
|
@ -5,17 +5,17 @@ from judge.models import VolunteerProblemVote, Problem, ProblemType
|
|||
|
||||
|
||||
def vote_problem(request):
|
||||
if not request.user or not request.user.has_perm('judge.suggest_problem_changes'):
|
||||
if not request.user or not request.user.has_perm("judge.suggest_problem_changes"):
|
||||
return HttpResponseBadRequest()
|
||||
if not request.method == 'POST':
|
||||
if not request.method == "POST":
|
||||
return HttpResponseBadRequest()
|
||||
try:
|
||||
types_id = request.POST.getlist('types[]')
|
||||
types_id = request.POST.getlist("types[]")
|
||||
types = ProblemType.objects.filter(id__in=types_id)
|
||||
problem = Problem.objects.get(code=request.POST['problem'])
|
||||
knowledge_points = request.POST['knowledge_points']
|
||||
thinking_points = request.POST['thinking_points']
|
||||
feedback = request.POST['feedback']
|
||||
problem = Problem.objects.get(code=request.POST["problem"])
|
||||
knowledge_points = request.POST["knowledge_points"]
|
||||
thinking_points = request.POST["thinking_points"]
|
||||
feedback = request.POST["feedback"]
|
||||
except Exception as e:
|
||||
return HttpResponseBadRequest()
|
||||
|
||||
|
@ -23,7 +23,7 @@ def vote_problem(request):
|
|||
vote, _ = VolunteerProblemVote.objects.get_or_create(
|
||||
voter=request.profile,
|
||||
problem=problem,
|
||||
defaults={'knowledge_points': 0, 'thinking_points': 0},
|
||||
defaults={"knowledge_points": 0, "thinking_points": 0},
|
||||
)
|
||||
vote.knowledge_points = knowledge_points
|
||||
vote.thinking_points = thinking_points
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue