zoukankan      html  css  js  c++  java
  • drf 组件

    中间件 
        request 
        view 
        exception 
        response
        render_template
    csrf原理(在这个里面process_view)    except  protect   
    
    rest 10个 https://www.cnblogs.com/wupeiqi/aticles/7805382.html
     通信协议https  域名 版本 路径 method 过滤  status 返回结果 error  Hypermedia API
    
    面向对象3大特性
        多态
        继承 多继承先左边 广度/深度优先 经典类/新式类
        封装 (为了以后打包使用)
            相同一堆属性方法封装在类中
            构造方法将一部分数据封装到每一个对象里面
    middleware 
    import json
    from django.utils.decorators import method_decorator
    from django.views.decorators.csrf import csrf_exempt,csrf_protect #免除 保护
    
    @csrf_exempt
    def uers(request):
        user_list = ['a','b']
        return HttpResponse(json.dumps(user_list))
    
    # cbv里面 直接加到方法无效
    # 法一
    class StuView(View):
        @method_decorator(csrf_exempt)
        def dispatch(self):
            print('here')
            return HttpResponse()
    
        def get(self):
            print('get')
            return HttpResponse()
    
    # 法二
    @method_decorator(csrf_exempt,name='dispatch')
    class StuView(View):
    
        def get(self):
            print('get')
            return HttpResponse()
    csrf_token 装饰器
  • 相关阅读:
    2.2 与球体相交-几何解
    2.1 与球体的交点 -代数解
    2 必要的光线追踪算法=>光线球体的相交和映射
    3.1 Matrix Properties
    chapter 3:Matriices
    4.8 渲染方程
    webstorm 皮肤(Sublime text)设置
    数字键盘(纯js)
    ios中设置readonly还会有光标?
    JS重要的坑
  • 原文地址:https://www.cnblogs.com/zhangchen-sx/p/11421558.html
Copyright © 2011-2022 走看看