#在views.py中加入
from django.contrib.auth import authenticate,login
user = authenticate(username=user_name,password=pass_word)
if user is not None:
login(request,user)
#html判断是否已经登陆
{% if request.user.is_authenticated %}
{%else%}
{% endif %}
表单验证
最新推荐文章于 2024-08-02 00:06:19 发布