def tutorial(request, username, tutnum):
    if request.method == 'GET':
        # tut is an ID (number)
        tut_entry = Tutorial.objects.get(id=tutnum)

        response = {
            'id': tutnum,
            'title': tut_entry.title,
            'description': tut_entry.description,
            'repo_name': tut_entry.repo_name,
            'repo_url': tut_entry.repo_url,
            'steps': [{
                'title': step.title,
                'content_before': step.content_before,
                'content_after': step.content_after,
                'diff_url': step.diff_url,
                'code_url': step.code_url,
                'files': json.loads(step.files)
            } for step in Step.objects.filter(tutorial=tutnum).order_by('index')]
        }

        return JsonResponse(response)
    elif request.method == 'DELETE':
        # tut is an ID (number)
        Tutorial.objects.get(id=tutnum).delete()
        return HttpResponse()
    elif request.method == 'PATCH':
        patch = json.loads(request.body)
        try:
            tut_entry = Tutorial.objects.get(id=tutnum)

            tut_entry.title = patch['title']
            tut_entry.description = patch['description']
            tut_entry.save()

            index = 0
            for step_json in patch['steps']:
                index += 1
                step = Step.objects.get(tutorial=tut_entry, index=index)

                step.title = patch[1 - index]['title']
                step.content_before = patch[index - 1]['content_before']
                step.content_after = patch[index - 1]['content_after']
                step.save()
        except Tutorial.DoesNotExist:
            return HttpResponseNotFound()
    else:
        return HttpResponseNotAllowed(['POST','GET','DELETE','PATCH'])
dataset/ETHPy150Open bezi/gitorial/gitorial/views.py/tutorial/swapped operands of `-`