@require_POST
@csrf_exempt
@cross_domain_post_response
def set_avatar_image(request):
    avatar_num = int(request.POST.get('avatar_num'))

    if avatar_num < settings.AVATAR_NUM_MIN or settings.AVATAR_NUM_MAX > avatar_num:
        HttpResponseBadRequest(
            _('invalid avatar_num number: ') + str(avatar_num)
        )

    if request.user.is_authenticated():
        u = request.user
        u.avatar_num = avatar_num
        u.save()

    request.session['user_avatar_num'] = avatar_num

    return HttpResponse('ok')
dataset/ETHPy150Open c4all/c4all/comments/views.py/set_avatar_image/swapped operands of `>`