开发者

Django class based generic views: cannot import name TemplateView

Dj开发者_Python百科ango fires exception cannot import name TemplateView how to fix this?

view.py :

from django.views.generic import TemplateView

class Monitor(TemplateView):
    template_name  = 'helo.html'


urls.py :

from monitor.views import Monitor

urlpatterns = patterns('',
    (r'^admin/', Monitor.as_view()),
)


I don't know what Django version you are using, but only in Django 1.3 a class called TemplateView exists. Its import should be:

from django.views.generic.base import TemplateView
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜