# csrf_exempt 跨域解决注释
@csrf_exempt
# 判断用户是否登录
if request.user.is_authenticated:
# 对象是否激活、启用、可用、正常状态。
if user is not None and user.is_active:
# @login_required使用这个方法是要求用户登录的,用户还没有登录,默认会跳转到‘/accounts/login/’。这个值可以在settings文件中通过LOGIN_URL参数来设定
@login_required
django 后端笔记
于 2020-01-07 10:00:39 首次发布