07 2020 档案
摘要:csrf 跨站请求伪造 1 ajax({ 2 3 data:{csrfmiddlewaretoken:$('[name=csrfmiddlewaretoken]').val(), 4 // csrfmiddlewaretoken:'{{ csrf_token }}', 5 } 6 }) 7 ajax
阅读全文
摘要:1 在定义的form类中写下面的方法: 2 #局部钩子 clean_字段名称 , 3 def clean_name(self): 4 value = self.cleaned_data['name'] 5 if '大壮' in value: 6 raise ValidationError('含有敏感
阅读全文
摘要:1 昨日内容回顾 2 3 Cookie 4 因为http协议是无状态的,那么就导致服务端与客户端没办法维持回话,所以浏览器出了个技术叫做cookie,基于cookie就能完成会话跟踪. 5 Cookie 相当于一个空的字典,浏览器每次访问服务器都会携带cookie,那么服务器就可以通过cookie设
阅读全文
摘要:1 def a_new_decorator(a_func): 2 3 def wrapTheFunction(): 4 print("I am doing some boring work before executing a_func()") 5 6 a_func() 7 8 print("I a
阅读全文