1. from django.contrib.auth import views as auth_views
    
  2. from django.urls import path
    
  3. from django.views.generic import RedirectView
    
  4. 
    
  5. from . import views
    
  6. from .models import Article, DateArticle
    
  7. 
    
  8. date_based_info_dict = {
    
  9.     "queryset": Article.objects.all(),
    
  10.     "date_field": "date_created",
    
  11.     "month_format": "%m",
    
  12. }
    
  13. 
    
  14. object_list_dict = {
    
  15.     "queryset": Article.objects.all(),
    
  16.     "paginate_by": 2,
    
  17. }
    
  18. 
    
  19. object_list_no_paginate_by = {
    
  20.     "queryset": Article.objects.all(),
    
  21. }
    
  22. 
    
  23. numeric_days_info_dict = dict(date_based_info_dict, day_format="%d")
    
  24. 
    
  25. date_based_datefield_info_dict = dict(
    
  26.     date_based_info_dict, queryset=DateArticle.objects.all()
    
  27. )
    
  28. 
    
  29. urlpatterns = [
    
  30.     path("accounts/login/", auth_views.LoginView.as_view(template_name="login.html")),
    
  31.     path("accounts/logout/", auth_views.LogoutView.as_view()),
    
  32.     # Special URLs for particular regression cases.
    
  33.     path("中文/target/", views.index_page),
    
  34. ]
    
  35. 
    
  36. # redirects, both temporary and permanent, with non-ASCII targets
    
  37. urlpatterns += [
    
  38.     path(
    
  39.         "nonascii_redirect/", RedirectView.as_view(url="/中文/target/", permanent=False)
    
  40.     ),
    
  41.     path(
    
  42.         "permanent_nonascii_redirect/",
    
  43.         RedirectView.as_view(url="/中文/target/", permanent=True),
    
  44.     ),
    
  45. ]
    
  46. 
    
  47. # json response
    
  48. urlpatterns += [
    
  49.     path("json/response/", views.json_response_view),
    
  50. ]