会话的保持和form表单
cookie
- 设置cookie
from django.shortcuts import render, HttpResponse, redirect, reverse def set_cookie(request): num = request.COOKIES.get('num', 0) num = str(int(num) + 1) response = render(request, 'crm/count.html', context={ 'num': num }) response.set_cookie('num', num, max_age=5) return response
设置超时间为5秒
session