2014-08-12 14:54:42 +00:00
|
|
|
from django.contrib.auth import views as auth_views
|
2018-12-07 22:52:28 +00:00
|
|
|
from django.urls import path
|
2012-04-25 19:17:47 +00:00
|
|
|
from django.views.generic import RedirectView
|
2011-04-02 13:27:40 +00:00
|
|
|
|
2014-04-02 00:46:34 +00:00
|
|
|
from . import views
|
2015-01-28 12:35:27 +00:00
|
|
|
from .models import Article, DateArticle
|
2011-04-02 13:27:40 +00: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 00:46:34 +00:00
|
|
|
urlpatterns = [
|
2018-12-07 22:52:28 +00:00
|
|
|
path('accounts/login/', auth_views.LoginView.as_view(template_name='login.html')),
|
|
|
|
path('accounts/logout/', auth_views.LogoutView.as_view()),
|
2011-04-02 13:27:40 +00:00
|
|
|
|
|
|
|
# Special URLs for particular regression cases.
|
2018-12-07 22:52:28 +00:00
|
|
|
path('中文/target/', views.index_page),
|
2014-04-02 00:46:34 +00:00
|
|
|
]
|
2011-04-02 13:27:40 +00:00
|
|
|
|
2014-03-02 14:25:53 +00:00
|
|
|
# redirects, both temporary and permanent, with non-ASCII targets
|
2014-04-02 00:46:34 +00:00
|
|
|
urlpatterns += [
|
2018-12-07 22:52:28 +00:00
|
|
|
path('nonascii_redirect/', RedirectView.as_view(url='/中文/target/', permanent=False)),
|
|
|
|
path('permanent_nonascii_redirect/', RedirectView.as_view(url='/中文/target/', permanent=True)),
|
2014-04-02 00:46:34 +00:00
|
|
|
]
|
|
|
|
|
2014-02-14 17:28:51 +00:00
|
|
|
# json response
|
2014-04-02 00:46:34 +00:00
|
|
|
urlpatterns += [
|
2018-12-07 22:52:28 +00:00
|
|
|
path('json/response/', views.json_response_view),
|
2014-04-02 00:46:34 +00:00
|
|
|
]
|