(request)
return ajax_success(users=users, msg="Username searched")
Used to search by the user handle.
Used to search by the user handle.
Used to search by the user handle .
def handle_search(request):
    """
    Used to search by the user handle.
    """

    query = request.GET.get('query')
    if query:
        users = User.objects.filter(profile__handle__icontains=query
                                    ).values_list('profile__handle', flat=True
                                                  ).order_by('profile__score')
    else:
        users = User.objects.order_by('profile__score').values_list('profile__handle', flat=True)

    users = list(users[:20])
    # Return list of users matching username
    return ajax_success(users=users, msg="Username searched")
def handle_search ( request ) : query = request . GET . get ( 'query' ) if query : users = User . objects . filter ( profile__handle__icontains = query ) . values_list ( 'profile__handle' , flat = True ) . order_by ( 'profile__score' ) else : users = User . objects . order_by ( 'profile__score' ) . values_list ( 'profile__handle' , flat = True ) users = list ( users [ : 20 ] ) # Return list of users matching username return ajax_success ( users = users , msg = "Username searched" )