CBV加装饰器 方式一: 装饰器加在类上 from django.utils.decorators import method_decorator @method_decorator(auth, name='get') 方式二: 装饰器直接加在方法上 from django.shortcuts import render, HttpResponse, redirect from app01 import models from django.views import View # 登录认证(判断session)功能