擅长:python、mysql、java
<p>当然可以。可以按如下方式创建类:</p>
<pre><code>class CardsCustomView(View):
...
class CardView(CardsCustomView):
def get(self, request, *args, **kwargs):
...
</code></pre>
<p>因为<code>CardView</code>从<code>CardCustomView</code>扩展而这一个从{<cd3>}扩展。在<code>CardView</code>中,您可以访问<code>View</code>的任何属性或方法(<a href="http://ccbv.co.uk/projects/Django/1.8/django.views.generic.base/View/" rel="nofollow">listed here</a>),以及您在<code>CardCustomView</code>中创建的任何属性或方法。举个例子:</p>
^{pr2}$
<p>然后您可以:</p>
<pre><code>class CardView(CardCustomView):
def get(self, request, *args, **kwargs):
self.state ... # This has 'started' value from parent class.
self.current_user_cards = self.get_user_cards() # This should have the cards for the current user
</code></pre>
<p>关于您的评论,基本<code>View</code>类没有<code>.get_context_data()</code>方法,正如您在上面提供的链接中看到的那样。在</p>