django 定制dispatch(派遣)方法;【扩展点】

# -------------------------------------------54.7
from django.views import View
class wusiqi(View):
    def dispatch(self, request, *args, **kwargs):
        print('123123123')
        # 定制父类dispatch(派遣)方法
        a = super(wusiqi,self).dispatch(request, *args, **kwargs)
        # 完全继承父类dispatch方法
        return a

    def get(self,request):
        # 根据请求头中的request method 选择执行函数
        return render(request,'index.html')

    def post(self,request):
        return HttpResponse('post')
原文地址:https://www.cnblogs.com/oysq/p/12680002.html