2011-04-02 21:27:40 +08:00
|
|
|
# -*- coding:utf-8 -*-
|
2013-07-30 01:19:04 +08:00
|
|
|
from __future__ import unicode_literals
|
2011-04-02 21:27:40 +08:00
|
|
|
|
2011-10-14 05:34:56 +08:00
|
|
|
from django.conf.urls import patterns, url
|
2012-04-26 03:17:47 +08:00
|
|
|
from django.views.generic import RedirectView
|
2011-04-02 21:27:40 +08:00
|
|
|
|
2013-10-18 19:25:30 +08:00
|
|
|
from .models import Article, DateArticle
|
2011-04-02 21:27:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
date_based_info_dict = {
|
|
|
|
'queryset': Article.objects.all(),
|
|
|
|
'date_field': 'date_created',
|
|
|
|
'month_format': '%m',
|
|
|
|
}
|
|
|
|
|
|
|
|
object_list_dict = {
|
|
|
|
'queryset': Article.objects.all(),
|
|
|
|
'paginate_by': 2,
|
|
|
|
}
|
|
|
|
|
|
|
|
object_list_no_paginate_by = {
|
|
|
|
'queryset': Article.objects.all(),
|
|
|
|
}
|
|
|
|
|
|
|
|
numeric_days_info_dict = dict(date_based_info_dict, day_format='%d')
|
|
|
|
|
|
|
|
date_based_datefield_info_dict = dict(date_based_info_dict, queryset=DateArticle.objects.all())
|
|
|
|
|
|
|
|
urlpatterns = patterns('',
|
|
|
|
(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
|
|
|
|
(r'^accounts/logout/$', 'django.contrib.auth.views.logout'),
|
|
|
|
|
|
|
|
# Special URLs for particular regression cases.
|
2013-02-26 20:19:18 +08:00
|
|
|
url('^中文/$', 'view_tests.views.redirect'),
|
|
|
|
url('^中文/target/$', 'view_tests.views.index_page'),
|
2011-04-02 21:27:40 +08:00
|
|
|
)
|
|
|
|
|
2014-03-02 22:25:53 +08:00
|
|
|
# redirects, both temporary and permanent, with non-ASCII targets
|
2012-04-26 03:17:47 +08:00
|
|
|
urlpatterns += patterns('',
|
|
|
|
('^nonascii_redirect/$', RedirectView.as_view(
|
2012-06-08 00:08:47 +08:00
|
|
|
url='/中文/target/', permanent=False)),
|
2012-04-26 03:17:47 +08:00
|
|
|
('^permanent_nonascii_redirect/$', RedirectView.as_view(
|
2012-06-08 00:08:47 +08:00
|
|
|
url='/中文/target/', permanent=True)),
|
2011-04-02 21:27:40 +08:00
|
|
|
)
|
|
|
|
|
2013-02-26 20:19:18 +08:00
|
|
|
urlpatterns += patterns('view_tests.views',
|
2011-04-02 21:27:40 +08:00
|
|
|
(r'^shortcuts/render_to_response/$', 'render_to_response_view'),
|
|
|
|
(r'^shortcuts/render_to_response/request_context/$', 'render_to_response_view_with_request_context'),
|
2013-01-31 20:39:29 +08:00
|
|
|
(r'^shortcuts/render_to_response/content_type/$', 'render_to_response_view_with_content_type'),
|
2013-09-16 05:51:24 +08:00
|
|
|
(r'^shortcuts/render_to_response/dirs/$', 'render_to_response_view_with_dirs'),
|
2011-04-02 21:27:40 +08:00
|
|
|
(r'^shortcuts/render/$', 'render_view'),
|
|
|
|
(r'^shortcuts/render/base_context/$', 'render_view_with_base_context'),
|
|
|
|
(r'^shortcuts/render/content_type/$', 'render_view_with_content_type'),
|
|
|
|
(r'^shortcuts/render/status/$', 'render_view_with_status'),
|
|
|
|
(r'^shortcuts/render/current_app/$', 'render_view_with_current_app'),
|
2013-09-16 05:51:24 +08:00
|
|
|
(r'^shortcuts/render/dirs/$', 'render_with_dirs'),
|
2011-04-02 21:27:40 +08:00
|
|
|
(r'^shortcuts/render/current_app_conflict/$', 'render_view_with_current_app_conflict'),
|
|
|
|
)
|
2014-02-15 01:28:51 +08:00
|
|
|
|
|
|
|
# json response
|
|
|
|
urlpatterns += patterns('view_tests.views',
|
|
|
|
(r'^json/response/$', 'json_response_view'),
|
|
|
|
)
|