我创建了登录页面,我提交了该页面,它会转到另一个页面。我希望在另一个页面上使用该特定用户名,所以我在重定向页面时会传递该名称,但它对我不起作用。。。
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