2015-04-23 38 views
-3

我試圖學習編程,並在我的核心應用程序中遇到了這個問題。什麼是python類?

from django.shortcuts import render 
from django.views.generic import TemplateView 
# Create your views here. 

class SplashView(TemplateView): 
    template_name = "index.html" 

在這種情況下,上述課程具體做了什麼?

+0

你甚至嘗試尋找自己嗎? – 2015-04-23 04:06:32

+0

可能重複的[Python - 類和OOP基礎](http://stackoverflow.com/questions/10004850/python-classes-and-oop-basics) –

+0

這不是一個初學者的好例子;這個特定的類是Django框架的一部分,因此無法單獨理解,而是框架如何使用這樣一個類。 – chepner

回答

4

它做的一切都是TemplateView,它還有一個名爲「template_name」的屬性,其值爲「index.html」。