@login_required(login_url='/accounts/login/')
def search(request):
    title = 'Upload New Post'
    current_profile = Profile.objects.filter(user_name=request.user.username).first()
    if (('search' in request.GET) and request.GET['search']):
        search_query = request.GET.get('search')
        print(search_query)
        found_users = Profile.objects.filter(user_name=search_query).all()
        return render(request, 'search.html', {'title': title, 'profile': current_profile, 'search_query': search_query, 'results': found_users})
    return render(request, 'search.html', {'title': title, 'profile': current_profile})
@login_required(login_url='/accounts/login/')
def search(request):
    title = 'Upload New Post'
    current_profile = Profile.objects.filter(user_name=request.user.username).first()
    if (('search' in request.GET) and request.GET['search']):
        search_query = request.GET.get('search')
        print(search_query)
        found_users = Profile.objects.filter(user_name=search_query).all()
        return render(request, 'search.html', {'title': title, 'profile': current_profile, 'search_query': search_query, 'results': found_users})
    return render(request, 'search.html', {'title': title, 'profile': current_profile})