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
|
2014-08-12 22:54:42 +08:00
|
|
|
from django.contrib.auth import views as auth_views
|
2012-04-26 03:17:47 +08:00
|
|
|
from django.views.generic import RedirectView
|
2011-04-02 21:27:40 +08:00
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
from . import views
|
2015-02-10 02:19:34 +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())
|
|
|
|
|
2014-04-02 08:46:34 +08:00
|
|
|
urlpatterns = [
|
2014-08-12 22:54:42 +08:00
|
|
|
url(r'^accounts/login/$', auth_views.login, {'template_name': 'login.html'}),
|
|
|
|
url(r'^accounts/logout/$', auth_views.logout),
|
2011-04-02 21:27:40 +08:00
|
|
|
|
|
|
|
# Special URLs for particular regression cases.
|
2014-08-12 22:54:42 +08:00
|
|
|
url('^中文/$', views.redirect),
|
|
|
|
url('^中文/target/$', 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
|
|
|
]
|
|
|
|
|
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),
|
|
|
|
]
|