Exemple #1
0
from djangocg.conf.urls import url
from djangocg.conf.urls.i18n import i18n_patterns
from djangocg.views.generic import TemplateView

view = TemplateView.as_view(template_name='dummy.html')

urlpatterns = i18n_patterns('',
    url(r'^prefixed/$', view, name='prefixed'),
)
Exemple #2
0
from djangocg.conf.urls import patterns, url
from djangocg.views.decorators.cache import cache_page
from djangocg.views.generic import TemplateView

from . import models
from . import views


urlpatterns = patterns('',
    # base
    #(r'^about/login-required/$',
    #    views.DecoratedAboutView()),

    # TemplateView
    (r'^template/no_template/$',
        TemplateView.as_view()),
    (r'^template/simple/(?P<foo>\w+)/$',
        TemplateView.as_view(template_name='generic_views/about.html')),
    (r'^template/custom/(?P<foo>\w+)/$',
        views.CustomTemplateView.as_view(template_name='generic_views/about.html')),

    (r'^template/cached/(?P<foo>\w+)/$',
        cache_page(2.0)(TemplateView.as_view(template_name='generic_views/about.html'))),

    # DetailView
    (r'^detail/obj/$',
        views.ObjectDetail.as_view()),
    url(r'^detail/artist/(?P<pk>\d+)/$',
        views.ArtistDetail.as_view(),
        name="artist_detail"),
    url(r'^detail/author/(?P<pk>\d+)/$',
Exemple #3
0
from djangocg.conf.urls import patterns, include, url
from djangocg.conf.urls.i18n import i18n_patterns
from djangocg.utils.translation import ugettext_lazy as _
from djangocg.views.generic import TemplateView


view = TemplateView.as_view(template_name="dummy.html")

urlpatterns = patterns(
    "",
    url(r"^not-prefixed/$", view, name="not-prefixed"),
    url(_(r"^translated/$"), view, name="no-prefix-translated"),
    url(_(r"^translated/(?P<slug>[\w-]+)/$"), view, name="no-prefix-translated-slug"),
)

urlpatterns += i18n_patterns(
    "",
    url(r"^prefixed/$", view, name="prefixed"),
    url(_(r"^users/$"), view, name="users"),
    url(_(r"^account/"), include("regressiontests.i18n.patterns.urls.namespace", namespace="account")),
)
Exemple #4
0
 def test_get_generic_template(self):
     """
     Test a completely generic view that renders a template on GET
     with the template name as an argument at instantiation.
     """
     self._assert_about(TemplateView.as_view(template_name='generic_views/about.html')(self.rf.get('/about/')))