我在 django 中重定向模板时传递一个值

Iam Passing an value when iam redirecting the template in django

我创建了登录页面并提交了该页面,它转到另一个页面我想要另一个页面上的特定用户名所以我在重定向页面时传递了该名称但它对我不起作用...

urls.py
from django.contrib import admin
from django.urls import path
from .import views

urlpatterns = [
         path('dash/',views.Dash,name='Dash'),
]


Dash.html
<div class="flex-grow-1">
<span class="fw-semibold d-block">{{name}}</span>
</div>


views.py
def Login(request):
    if request.method=='POST':
     username=request.POST['username']
     password=request.POST['password']
     user=auth.authenticate(username=username,password=password)
     if user is not None:
         request.session['user'] = username
         auth.login(request,user)
         return redirect('/dash',{name:user})

This is my code why I am not getting the name? Please anyone help me

如果登录成功。您不需要在模板中传递用户名。您可以访问模板中的用户 {{request.user}} 和用户名 {{request.user.username}}.