예제 #1
0
파일: urls.py 프로젝트: iMerica/dj-models
from djmodels.conf.urls import url
from djmodels.urls import path

from . import views

urlpatterns = [
    url(r'^innocent/$', views.innocent),
    path('redirect/', views.redirect),
    url(r'^suspicious/$', views.suspicious),
    url(r'^suspicious_spec/$', views.suspicious_spec),
    path('internal_server_error/', views.internal_server_error),
    path('uncaught_exception/', views.uncaught_exception),
    path('permission_denied/', views.permission_denied),
    path('multi_part_parser_error/', views.multi_part_parser_error),
    path('does_not_exist_raised/', views.does_not_exist_raised),
]
예제 #2
0
from djmodels.conf.urls import url
from djmodels.urls import path
from djmodels.utils.translation import gettext_lazy as _
from djmodels.views.generic import TemplateView

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

app_name = 'account'
urlpatterns = [
    url(_(r'^register/$'), view, name='register'),
    url(_(r'^register-without-slash$'), view, name='register-without-slash'),
    path(_('register-as-path/'), view, name='register-as-path'),
]
예제 #3
0
    This may only be used in the root URLconf, not in an included URLconf.
    """
    if not settings.USE_I18N:
        return list(urls)
    return [
        URLResolver(
            LocalePrefixPattern(
                prefix_default_language=prefix_default_language),
            list(urls),
        )
    ]


@functools.lru_cache(maxsize=None)
def is_language_prefix_patterns_used(urlconf):
    """
    Return a tuple of two booleans: (
        `True` if i18n_patterns() (LocalePrefixPattern) is used in the URLconf,
        `True` if the default language should be prefixed
    )
    """
    for url_pattern in get_resolver(urlconf).url_patterns:
        if isinstance(url_pattern.pattern, LocalePrefixPattern):
            return True, url_pattern.pattern.prefix_default_language
    return False, False


urlpatterns = [
    path('setlang/', set_language, name='set_language'),
]
예제 #4
0
from djmodels.conf.urls import url
from djmodels.urls import path

urlpatterns = [
    path('/path-starting-with-slash/', lambda x: x),
    url(r'/url-starting-with-slash/$', lambda x: x),
]
예제 #5
0
파일: urls.py 프로젝트: iMerica/dj-models
from djmodels.contrib.flatpages import views
from djmodels.urls import path

urlpatterns = [
    path('<path:url>',
         views.flatpage,
         name='djmodels.contrib.flatpages.views.flatpage'),
]
예제 #6
0
from djmodels.urls import path

urlpatterns = [
    path('^beginning-with-caret', lambda x: x),
]
예제 #7
0
from djmodels.urls import path

urlpatterns = [
    path('ending-with-dollar$', lambda x: x),
]
예제 #8
0
from djmodels.urls import include, path

urlpatterns = [
    path('', include([(r'^tuple/$', lambda x: x)])),
]
예제 #9
0
from djmodels.urls import path

urlpatterns = [
    path(r'(?P<named-group>\d+)', lambda x: x),
]