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
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
from django.conf.urls import 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
|
2014-04-02 08:46:34 +08:00
|
|
|
from . import views
|
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())
|
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
urlpatterns = [
|
|
|
|
url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
|
|
|
|
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout'),
|
2011-04-02 21:27:40 +08:00
|
|
|
|
|
|
|
# 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'),
|
2014-04-02 08:46:34 +08:00
|
|
|
]
|
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
|
2014-04-02 08:46:34 +08:00
|
|
|
urlpatterns += [
|
|
|
|
url('^nonascii_redirect/$', RedirectView.as_view(
|
2012-06-08 00:08:47 +08:00
|
|
|
url='/中文/target/', permanent=False)),
|
2014-04-02 08:46:34 +08:00
|
|
|
url('^permanent_nonascii_redirect/$', RedirectView.as_view(
|
2012-06-08 00:08:47 +08:00
|
|
|
url='/中文/target/', permanent=True)),
|
2014-04-02 08:46:34 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
urlpatterns += [
|
|
|
|
url(r'^shortcuts/render_to_response/$', views.render_to_response_view),
|
|
|
|
url(r'^shortcuts/render_to_response/request_context/$', views.render_to_response_view_with_request_context),
|
|
|
|
url(r'^shortcuts/render_to_response/content_type/$', views.render_to_response_view_with_content_type),
|
|
|
|
url(r'^shortcuts/render_to_response/dirs/$', views.render_to_response_view_with_dirs),
|
|
|
|
url(r'^shortcuts/render/$', views.render_view),
|
|
|
|
url(r'^shortcuts/render/base_context/$', views.render_view_with_base_context),
|
|
|
|
url(r'^shortcuts/render/content_type/$', views.render_view_with_content_type),
|
|
|
|
url(r'^shortcuts/render/status/$', views.render_view_with_status),
|
|
|
|
url(r'^shortcuts/render/current_app/$', views.render_view_with_current_app),
|
|
|
|
url(r'^shortcuts/render/dirs/$', views.render_with_dirs),
|
|
|
|
url(r'^shortcuts/render/current_app_conflict/$', views.render_view_with_current_app_conflict),
|
|
|
|
]
|
2014-02-15 01:28:51 +08:00
|
|
|
|
|
|
|
# json response
|
2014-04-02 08:46:34 +08:00
|
|
|
urlpatterns += [
|
|
|
|
url(r'^json/response/$', views.json_response_view),
|
|
|
|
]
|