- flask的数据迁移
init
migrate
upgrade
- django的数据迁移
python manage.py makemigrations
python manage.py migrate
- session的使用
def c_title(request):
request.session[‘title‘] = request.POST.get(‘title‘)
request.session[‘title‘] = request.POST.get(‘name‘)
request.session[‘title‘] = request.POST.get(‘content‘)
print(request.session.get(‘title‘))
return redirect(‘/three/title’)
- 分页
title = request.session.get(‘title‘)
name = request.session.get(‘name‘)
content = request.session.get(‘content‘)
student_list = Xiaoshuo.objects.all()
if title:
student_list = student_list.objects.filter(title__contains=title)
if name:
student_list = Xiaoshuo.objects.filter(name__contains=name)
if content:
student_list = student_list.objects.filter(content__contains=content)
print(name)
//分页,不完全版,可以不通过session来判断
student_list = Xiaoshuo.objects.all().filter(name__contains=name).filter(title__contains=title).filter(content__contains=content)
# DB迁移工具