擅长:python、mysql、java
<p>您需要将decorator应用于基于类的视图的分派方法。具体操作如下:</p>
<pre><code>class ProfileView(View):
@youdecorator
def dispatch(self,request,*args,**kwargs):
return super(ProfileView,self).dispatch(request,*args,**kwargs)
//Rest of your code.
</code></pre>