Python django.views.generic.TemplateView 模块,as_view() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用django.views.generic.TemplateView.as_view()

项目:djangoql    作者:ivelum    | 项目源码 | 文件源码
def get_urls(self):
        custom_urls = []
        if self.djangoql_completion:
            custom_urls += [
                url(
                    r'^introspect/$',
                    self.admin_site.admin_view(self.introspect),
                    name='%s_%s_djangoql_introspect' % (
                        self.model._meta.app_label,
                        self.model._meta.model_name,
                    ),
                ),
                url(
                    r'^djangoql-syntax/$',
                    TemplateView.as_view(
                        template_name=self.djangoql_syntax_help_template,
                    ),
                    name='djangoql_syntax_help',
                ),
            ]
        return custom_urls + super(DjangoQLSearchMixin, self).get_urls()
项目:pyconjp-website    作者:pyconjp    | 项目源码 | 文件源码
def gen_urls():
    include_patterns = patterns("",
                                url(r"^$", TemplateView.as_view(template_name="homepage.html"),
                                    name="home"),
                                url(r"^admin/", include(admin.site.urls)),
                                url(r"^account/signup/$", pycon.profile.views.SignupView.as_view(),
                                    name="account_signup"),
                                url(r"^account/login/$", symposion.views.LoginView.as_view(), name="account_login"),
                                url(r"^account/social/", include("social_auth.urls")),
                                url(r"^account/associations/", include("symposion.social_auth.urls")),
                                url(r"^account/", include("account.urls")),
                                url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
                                url(r"^blog/", include("biblion.urls")),
                                url(r"^force500/", lambda request: xxx),
                                url(r"^registration/", include("pycon.registration.urls")),
                                url(r"^finaid/", include("pycon.finaid.urls")),
                                url(r"^pycon_api/", include("pycon.pycon_api.urls")),
                                url(r"^api/", include("pycon.apis.urls")),
                                url(r"^schedule/", include("pycon.schedule.urls")),
                                url(r"^profile/", include("pycon.profile.urls")),
                                url(r"^tutorials/", include("pycon.tutorials.urls")),

                                url(r"^speaker/", include("symposion.speakers.urls")),
                                url(r"^speaker/list$", speaker_views.speaker_list, name='speaker_list'),
                                url(r"^proposals/", include("pycon.proposals.urls")),
                                url(r"^reviews/", include("symposion.reviews.urls")),
                                url(r"^teams/", include("symposion.teams.urls")),
                                url(r"^schedule/", include("symposion.schedule.urls")),
                                url(r"^conference/", include("symposion.conference.urls")),

                                url(r"^sponsors/", include("pycon.sponsorship.urls")),

                                url(r"^boxes/", include("symposion.boxes.urls")),
                                url(r"^sitemap/", TemplateView.as_view(template_name="static/sitemap.html"),
                                    name="sitemap"),
                                url(r'^selectable/', include('selectable.urls')),
                                url(r"^change_language/", symposion.views.change_language, name="change_language"),
                                url(r"^", include("pycon.urls")),

                                # This should be last, because it will create a new CMS page for
                                # any unrecognized URL.
                                url(r"^", include("restcms.urls")),
                                url(r'^localeurl/', include('localeurlcustom.urls')),
    )

    for key, val in settings.LANGUAGES:
        yield url(r"^%s/%s/" % (URL_PREFIX, key), include(include_patterns))