PageRenderTime 40ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/regressiontests/generic_views/urls.py

https://code.google.com/p/mango-py/
Python | 217 lines | 214 code | 3 blank | 0 comment | 0 complexity | 79b77898b99c9b49f3470253892ab38b MD5 | raw file
Possible License(s): BSD-3-Clause
  1. from django.conf.urls.defaults import *
  2. from django.views.generic import TemplateView
  3. from django.views.decorators.cache import cache_page
  4. import views
  5. urlpatterns = patterns('',
  6. # base
  7. #(r'^about/login-required/$',
  8. # views.DecoratedAboutView()),
  9. # TemplateView
  10. (r'^template/no_template/$',
  11. TemplateView.as_view()),
  12. (r'^template/simple/(?P<foo>\w+)/$',
  13. TemplateView.as_view(template_name='generic_views/about.html')),
  14. (r'^template/custom/(?P<foo>\w+)/$',
  15. views.CustomTemplateView.as_view(template_name='generic_views/about.html')),
  16. (r'^template/cached/(?P<foo>\w+)/$',
  17. cache_page(2.0)(TemplateView.as_view(template_name='generic_views/about.html'))),
  18. # DetailView
  19. (r'^detail/obj/$',
  20. views.ObjectDetail.as_view()),
  21. url(r'^detail/artist/(?P<pk>\d+)/$',
  22. views.ArtistDetail.as_view(),
  23. name="artist_detail"),
  24. url(r'^detail/author/(?P<pk>\d+)/$',
  25. views.AuthorDetail.as_view(),
  26. name="author_detail"),
  27. (r'^detail/author/byslug/(?P<slug>[\w-]+)/$',
  28. views.AuthorDetail.as_view()),
  29. (r'^detail/author/(?P<pk>\d+)/template_name_suffix/$',
  30. views.AuthorDetail.as_view(template_name_suffix='_view')),
  31. (r'^detail/author/(?P<pk>\d+)/template_name/$',
  32. views.AuthorDetail.as_view(template_name='generic_views/about.html')),
  33. (r'^detail/author/(?P<pk>\d+)/context_object_name/$',
  34. views.AuthorDetail.as_view(context_object_name='thingy')),
  35. (r'^detail/author/(?P<pk>\d+)/dupe_context_object_name/$',
  36. views.AuthorDetail.as_view(context_object_name='object')),
  37. (r'^detail/page/(?P<pk>\d+)/field/$',
  38. views.PageDetail.as_view()),
  39. (r'^detail/author/invalid/url/$',
  40. views.AuthorDetail.as_view()),
  41. (r'^detail/author/invalid/qs/$',
  42. views.AuthorDetail.as_view(queryset=None)),
  43. # Create/UpdateView
  44. (r'^edit/artists/create/$',
  45. views.ArtistCreate.as_view()),
  46. (r'^edit/artists/(?P<pk>\d+)/update/$',
  47. views.ArtistUpdate.as_view()),
  48. (r'^edit/authors/create/naive/$',
  49. views.NaiveAuthorCreate.as_view()),
  50. (r'^edit/authors/create/redirect/$',
  51. views.NaiveAuthorCreate.as_view(success_url='/edit/authors/create/')),
  52. (r'^edit/authors/create/interpolate_redirect/$',
  53. views.NaiveAuthorCreate.as_view(success_url='/edit/author/%(id)d/update/')),
  54. (r'^edit/authors/create/restricted/$',
  55. views.AuthorCreateRestricted.as_view()),
  56. (r'^edit/authors/create/$',
  57. views.AuthorCreate.as_view()),
  58. (r'^edit/authors/create/special/$',
  59. views.SpecializedAuthorCreate.as_view()),
  60. (r'^edit/author/(?P<pk>\d+)/update/naive/$',
  61. views.NaiveAuthorUpdate.as_view()),
  62. (r'^edit/author/(?P<pk>\d+)/update/redirect/$',
  63. views.NaiveAuthorUpdate.as_view(success_url='/edit/authors/create/')),
  64. (r'^edit/author/(?P<pk>\d+)/update/interpolate_redirect/$',
  65. views.NaiveAuthorUpdate.as_view(success_url='/edit/author/%(id)d/update/')),
  66. (r'^edit/author/(?P<pk>\d+)/update/$',
  67. views.AuthorUpdate.as_view()),
  68. (r'^edit/author/update/$',
  69. views.OneAuthorUpdate.as_view()),
  70. (r'^edit/author/(?P<pk>\d+)/update/special/$',
  71. views.SpecializedAuthorUpdate.as_view()),
  72. (r'^edit/author/(?P<pk>\d+)/delete/naive/$',
  73. views.NaiveAuthorDelete.as_view()),
  74. (r'^edit/author/(?P<pk>\d+)/delete/redirect/$',
  75. views.NaiveAuthorDelete.as_view(success_url='/edit/authors/create/')),
  76. (r'^edit/author/(?P<pk>\d+)/delete/$',
  77. views.AuthorDelete.as_view()),
  78. (r'^edit/author/(?P<pk>\d+)/delete/special/$',
  79. views.SpecializedAuthorDelete.as_view()),
  80. # ArchiveIndexView
  81. (r'^dates/books/$',
  82. views.BookArchive.as_view()),
  83. (r'^dates/books/context_object_name/$',
  84. views.BookArchive.as_view(context_object_name='thingies')),
  85. (r'^dates/books/allow_empty/$',
  86. views.BookArchive.as_view(allow_empty=True)),
  87. (r'^dates/books/template_name/$',
  88. views.BookArchive.as_view(template_name='generic_views/list.html')),
  89. (r'^dates/books/template_name_suffix/$',
  90. views.BookArchive.as_view(template_name_suffix='_detail')),
  91. (r'^dates/books/invalid/$',
  92. views.BookArchive.as_view(queryset=None)),
  93. (r'^dates/books/paginated/$',
  94. views.BookArchive.as_view(paginate_by=10)),
  95. # ListView
  96. (r'^list/dict/$',
  97. views.DictList.as_view()),
  98. (r'^list/dict/paginated/$',
  99. views.DictList.as_view(paginate_by=1)),
  100. url(r'^list/artists/$',
  101. views.ArtistList.as_view(),
  102. name="artists_list"),
  103. url(r'^list/authors/$',
  104. views.AuthorList.as_view(),
  105. name="authors_list"),
  106. (r'^list/authors/paginated/$',
  107. views.AuthorList.as_view(paginate_by=30)),
  108. (r'^list/authors/paginated/(?P<page>\d+)/$',
  109. views.AuthorList.as_view(paginate_by=30)),
  110. (r'^list/authors/notempty/$',
  111. views.AuthorList.as_view(allow_empty=False)),
  112. (r'^list/authors/template_name/$',
  113. views.AuthorList.as_view(template_name='generic_views/list.html')),
  114. (r'^list/authors/template_name_suffix/$',
  115. views.AuthorList.as_view(template_name_suffix='_objects')),
  116. (r'^list/authors/context_object_name/$',
  117. views.AuthorList.as_view(context_object_name='author_list')),
  118. (r'^list/authors/dupe_context_object_name/$',
  119. views.AuthorList.as_view(context_object_name='object_list')),
  120. (r'^list/authors/invalid/$',
  121. views.AuthorList.as_view(queryset=None)),
  122. (r'^list/authors/paginated/custom_class/$',
  123. views.AuthorList.as_view(paginate_by=5, paginator_class=views.CustomPaginator)),
  124. (r'^list/authors/paginated/custom_constructor/$',
  125. views.AuthorListCustomPaginator.as_view()),
  126. # YearArchiveView
  127. # Mixing keyword and possitional captures below is intentional; the views
  128. # ought to be able to accept either.
  129. (r'^dates/books/(?P<year>\d{4})/$',
  130. views.BookYearArchive.as_view()),
  131. (r'^dates/books/(?P<year>\d{4})/make_object_list/$',
  132. views.BookYearArchive.as_view(make_object_list=True)),
  133. (r'^dates/books/(?P<year>\d{4})/allow_empty/$',
  134. views.BookYearArchive.as_view(allow_empty=True)),
  135. (r'^dates/books/(?P<year>\d{4})/allow_future/$',
  136. views.BookYearArchive.as_view(allow_future=True)),
  137. (r'^dates/books/(?P<year>\d{4})/paginated/$',
  138. views.BookYearArchive.as_view(make_object_list=True, paginate_by=30)),
  139. (r'^dates/books/no_year/$',
  140. views.BookYearArchive.as_view()),
  141. # MonthArchiveView
  142. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/$',
  143. views.BookMonthArchive.as_view()),
  144. (r'^dates/books/(?P<year>\d{4})/(?P<month>\d{1,2})/$',
  145. views.BookMonthArchive.as_view(month_format='%m')),
  146. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/allow_empty/$',
  147. views.BookMonthArchive.as_view(allow_empty=True)),
  148. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/allow_future/$',
  149. views.BookMonthArchive.as_view(allow_future=True)),
  150. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/paginated/$',
  151. views.BookMonthArchive.as_view(paginate_by=30)),
  152. (r'^dates/books/(?P<year>\d{4})/no_month/$',
  153. views.BookMonthArchive.as_view()),
  154. # WeekArchiveView
  155. (r'^dates/books/(?P<year>\d{4})/week/(?P<week>\d{1,2})/$',
  156. views.BookWeekArchive.as_view()),
  157. (r'^dates/books/(?P<year>\d{4})/week/(?P<week>\d{1,2})/allow_empty/$',
  158. views.BookWeekArchive.as_view(allow_empty=True)),
  159. (r'^dates/books/(?P<year>\d{4})/week/(?P<week>\d{1,2})/allow_future/$',
  160. views.BookWeekArchive.as_view(allow_future=True)),
  161. (r'^dates/books/(?P<year>\d{4})/week/(?P<week>\d{1,2})/paginated/$',
  162. views.BookWeekArchive.as_view(paginate_by=30)),
  163. (r'^dates/books/(?P<year>\d{4})/week/no_week/$',
  164. views.BookWeekArchive.as_view()),
  165. (r'^dates/books/(?P<year>\d{4})/week/(?P<week>\d{1,2})/monday/$',
  166. views.BookWeekArchive.as_view(week_format='%W')),
  167. # DayArchiveView
  168. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/$',
  169. views.BookDayArchive.as_view()),
  170. (r'^dates/books/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$',
  171. views.BookDayArchive.as_view(month_format='%m')),
  172. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/allow_empty/$',
  173. views.BookDayArchive.as_view(allow_empty=True)),
  174. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/allow_future/$',
  175. views.BookDayArchive.as_view(allow_future=True)),
  176. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/paginated/$',
  177. views.BookDayArchive.as_view(paginate_by=True)),
  178. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/no_day/$',
  179. views.BookDayArchive.as_view()),
  180. # TodayArchiveView
  181. (r'dates/books/today/$',
  182. views.BookTodayArchive.as_view()),
  183. (r'dates/books/today/allow_empty/$',
  184. views.BookTodayArchive.as_view(allow_empty=True)),
  185. # DateDetailView
  186. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/(?P<pk>\d+)/$',
  187. views.BookDetail.as_view()),
  188. (r'^dates/books/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<pk>\d+)/$',
  189. views.BookDetail.as_view(month_format='%m')),
  190. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/(?P<pk>\d+)/allow_future/$',
  191. views.BookDetail.as_view(allow_future=True)),
  192. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/nopk/$',
  193. views.BookDetail.as_view()),
  194. (r'^dates/books/(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\d{1,2})/byslug/(?P<slug>[\w-]+)/$',
  195. views.BookDetail.as_view()),
  196. # Useful for testing redirects
  197. (r'^accounts/login/$', 'django.contrib.auth.views.login')
  198. )