1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
from django.contrib.auth.views import LoginView
from django.urls import path
from django.urls import include, re_path
from . import views
urlpatterns = [
# LoginRequiredMixin tests
path("login_required/", views.LoginRequiredView.as_view()),
# AnonymousRequiredView tests
path(
"unauthenticated_view/",
views.AnonymousRequiredView.as_view(),
name="unauthenticated_view",
),
path(
"authenticated_view/",
views.AuthenticatedView.as_view(),
name="authenticated_view",
),
# AjaxResponseMixin tests
path("ajax_response/", views.AjaxResponseView.as_view()),
# CreateAndRedirectToEditView tests
path("article/create/", views.CreateArticleView.as_view()),
path(
"article/<int:pk>/edit/",
views.EditArticleView.as_view(),
name="edit_article",
),
path(
"article_list/create/",
views.CreateArticleAndRedirectToListView.as_view(),
),
path(
"article_list_bad/create/",
views.CreateArticleAndRedirectToListViewBad.as_view(),
),
path(
"article_list/",
views.ArticleListView.as_view(),
name="article_list",
),
# CanonicalSlugDetailMixin tests
re_path(
r"^article-canonical/(?P<pk>\d+)-(?P<slug>[-\w]+)/$",
views.CanonicalSlugDetailView.as_view(),
name="canonical_slug",
),
re_path(
r"^article-canonical-override/(?P<pk>\d+)-(?P<slug>[-\w]+)/$",
views.OverriddenCanonicalSlugDetailView.as_view(),
name="canonical_override",
),
re_path(
r"^article-canonical-custom-kwargs/(?P<my_pk>\d+)-(?P<my_slug>[-\w]+)/$",
views.CanonicalSlugDetailCustomUrlKwargsView.as_view(),
name="canonical_custom_kwargs",
),
re_path(
r"^article-canonical-model/(?P<pk>\d+)-(?P<slug>[-\w]+)/$",
views.ModelCanonicalSlugDetailView.as_view(),
name="canonical_model",
),
# UserFormKwargsMixin tests
path("form_with_user_kwarg/", views.FormWithUserKwargView.as_view()),
# SetHeadlineMixin tests
path("headline/", views.HeadlineView.as_view(), name="headline"),
path("headline/lazy/", views.LazyHeadlineView.as_view()),
re_path(r"^headline/(?P<s>[\w-]+)/$", views.DynamicHeadlineView.as_view()),
# ExtraContextMixin tests
path("context/", views.ContextView.as_view(), name="context"),
# PermissionRequiredMixin tests
path("permission_required/", views.PermissionRequiredView.as_view()),
path("object_level_permission_required/", views.PermissionRequiredView.as_view(object_level_permissions=True)),
# MultiplePermissionsRequiredMixin tests
path(
"multiple_permissions_required/",
views.MultiplePermissionsRequiredView.as_view(),
),
path(
"multiple_object_level_permissions_required/",
views.MultiplePermissionsRequiredView.as_view(object_level_permissions=True),
),
# SuperuserRequiredMixin tests
path("superuser_required/", views.SuperuserRequiredView.as_view()),
# StaffuserRequiredMixin tests
path("staffuser_required/", views.StaffuserRequiredView.as_view()),
# GroupRequiredMixin tests
path("group_required/", views.GroupRequiredView.as_view()),
# UserPassesTestMixin tests
path("user_passes_test/", views.UserPassesTestView.as_view()),
# UserPassesTestMixin tests
path(
"user_passes_test_not_implemented/",
views.UserPassesTestNotImplementedView.as_view(),
),
# CsrfExemptMixin tests
path("csrf_exempt/", views.CsrfExemptView.as_view()),
# JSONResponseMixin tests
path("simple_json/", views.SimpleJsonView.as_view()),
path(
"simple_json_custom_encoder/", views.CustomJsonEncoderView.as_view()
),
path("simple_json_400/", views.SimpleJsonBadRequestView.as_view()),
path("article_list_json/", views.ArticleListJsonView.as_view()),
# JsonRequestResponseMixin tests
path("json_request/", views.JsonRequestResponseView.as_view()),
path("json_bad_request/", views.JsonBadRequestView.as_view()),
path(
"json_custom_bad_request/", views.JsonCustomBadRequestView.as_view()
),
# FormMessagesMixin tests
path("form_messages/", views.FormMessagesView.as_view()),
# AllVerbsMixin tests
path("all_verbs/", views.AllVerbsView.as_view()),
path(
"all_verbs_no_handler/", views.AllVerbsView.as_view(all_handler=None)
),
# SSLRequiredMixin tests
path("sslrequired/", views.SSLRequiredView.as_view()),
# RecentLoginRequiredMixin tests
path("recent_login/", views.RecentLoginRequiredView.as_view()),
path("outdated_login/", views.RecentLoginRequiredView.as_view()),
# HeaderMixin tests
path('headers/attribute/', views.AttributeHeaderView.as_view()),
path('headers/method/', views.MethodHeaderView.as_view()),
path('headers/existing/', views.ExistingHeaderView.as_view()),
# CacheControlMixin tests
path('cachecontrol/public/', views.CacheControlPublicView.as_view()),
# NeverCacheMixin tests
path('nevercache/', views.NeverCacheView.as_view()),
]
urlpatterns += [
path(
"accounts/login/", LoginView.as_view(template_name="blank.html")
),
path("auth/login/", LoginView.as_view(template_name="blank.html")),
]
urlpatterns += [
path(
"article-canonical-namespaced/",
include(
("tests.urls_namespaced", "tests"), namespace="some_namespace"
),
),
]
|