示例#1
0
def buy_share(request):
    user = request.user
    if not user.is_superuser and not is_user_financier(user):
        return JsonResponse({'success': False, 'error': 'Недостаточно прав'})

    response = fetch_buy_share_response(request)
    return JsonResponse(response)
示例#2
0
def give_money(request):
    user = request.user
    if not user.is_superuser and not is_user_financier(user):
        return JsonResponse({'success': False, 'error': 'Недостаточно прав'})

    response = fetch_transfer_money_response(request, give_money=True)
    return JsonResponse(response)
示例#3
0
def exchange_rates(request):
    user = request.user
    if not user.is_superuser and not is_user_financier(user):
        return JsonResponse({'success': False, 'error': 'Недостаточно прав'})

    serialized_rates = get_exchange_rates()
    return JsonResponse(serialized_rates, safe=False)