Example #1
0
def get_authenticated_user(request):
    if request.user.is_authenticated():
        serialized = serializers.account_serializer(request.user.account)
        serialized['is_authenticated'] = True
        return JsonResponse(serialized)

    return JsonResponse({
        'is_authenticated': False
    })
Example #2
0
def get_friends(request, account_id):
    account = utils.get_account(account_id)
    others = request.GET.get('others') and request.GET.get('others').split(',') or []

    friends = utils.get_friends_number_matches(account, others)
    
    serialized = []

    if friends:
        for f in friends:
            friend = serializers.account_serializer(f)
            friend['qtd'] = f.qtd

            serialized.append(friend)

    return JsonResponse({'friends': serialized})
Example #3
0
def get_profile(request, account_id):
    account = utils.get_account(account_id)
    serialized = serializers.account_serializer(account)

    return JsonResponse(serialized)