[Answered ]-Return redirect wont pass parameters

1👍

With redirect, you can use the name of the path, and then pass positional and/or keyword parameter.

Another problem is that you use .filter(…) [Django-doc], this thus means that you retrieve a collection of objects (that can contain zero, one, or more last_boards. YOu should retrieve only one, so:

def index(request):
    usuario = request.user
    if request.method == 'GET' and usuario.is_authenticated:
        usr = get_object_or_404(Usuario, user=usuario.id)
        #  name of the view ↓
        return redirect('board', id=usr.last_board)
    return render(request, "index.html")

Leave a comment