@login_required(login_url='/login')
def user_profile(request, username):
    current_user = request.user
    user_selected = User.objects.get(username=username)
    user_profile = Profile.filter_profile_by_id(user_selected.id)
    projects = Project.objects.filter(user=user_profile)
    if (request.user == user_selected):
        return redirect('main:profile', username=username)
    ctx = {'user_profile': user_profile, 'projects': projects}
    return render(request, 'main/user_profile.html', ctx)
@login_required(login_url='/login')
def user_profile(request, username):
    current_user = request.user
    user_selected = User.objects.get(username=username)
    user_profile = Profile.filter_profile_by_id(user_selected.id)
    projects = Project.objects.filter(user=user_profile)
    if (request.user == user_selected):
        return redirect('main:profile', username=username)
    ctx = {'user_profile': user_profile, 'projects': projects}
    return render(request, 'main/user_profile.html', ctx)