使用会话:https://docs.djangoproject.com/en/1.8/topics/http/sessions/
然后做一些像:
def my_view(request, *args, **kwargs):
if request.session.get('visited', False):
# response without the welcome message
else:
request.session['visited'] = True
# response with the welcome message
Run Code Online (Sandbox Code Playgroud)
对于与会话相关的设置(例如到期),请参阅https://docs.djangoproject.com/en/1.8/topics/http/sessions/#browser-length-sessions-vs-persistent-sessions
| 归档时间: |
|
| 查看次数: |
1133 次 |
| 最近记录: |