Django 2.0 compatibility (requirement)

- URLs to path() style
- Misc updates
- Namespaces all URL references
- Removes dependency on AutoSlugField
- Cleaner reversals
- Cleaner docstrings
This commit is contained in:
Scot Hacker 2018-02-03 00:09:23 -08:00
parent 238e39085d
commit 90c41d1f29
13 changed files with 92 additions and 96 deletions

View file

@ -1,23 +1,26 @@
from django.conf.urls import url
from django.urls import path
from todo import views
app_name = 'todo'
urlpatterns = [
url(r'^$', views.list_lists, name="todo-lists"),
url(r'^mine/$', views.view_list, {'list_slug': 'mine'}, name="todo-mine"),
url(r'^(?P<list_id>\d{1,4})/(?P<list_slug>[\w-]+)/delete$', views.del_list, name="todo-del_list"),
url(r'^task/(?P<task_id>\d{1,6})$', views.view_task, name='todo-task_detail'),
url(r'^(?P<list_id>\d{1,4})/(?P<list_slug>[\w-]+)$', views.view_list, name='todo-incomplete_tasks'),
url(r'^(?P<list_id>\d{1,4})/(?P<list_slug>[\w-]+)/completed$', views.view_list, {'view_completed': True},
name='todo-completed_tasks'),
url(r'^add_list/$', views.add_list, name="todo-add_list"),
url(r'^search-post/$', views.search_post, name="todo-search-post"),
url(r'^search/$', views.search, name="todo-search"),
path('', views.list_lists, name="lists"),
path('mine/', views.view_list, {'list_slug': 'mine'}, name="mine"),
path('<int:list_id>/<str:list_slug>/delete$', views.del_list, name="del_list"),
path('task/<int:task_id>', views.view_task, name='task_detail'),
path('<int:list_id>/<str:list_slug>', views.view_list, name='incomplete_tasks'),
path('<int:list_id>/<str:list_slug>/completed$', views.view_list, {'view_completed': True}, name='completed_tasks'),
path('add_list/', views.add_list, name="add_list"),
# FIXME need both of these?
path('search-post/', views.search_post, name="search-post"),
path('search/', views.search, name="search"),
# View reorder_tasks is only called by JQuery for drag/drop task ordering
url(r'^reorder_tasks/$', views.reorder_tasks, name="todo-reorder_tasks"),
path('reorder_tasks/', views.reorder_tasks, name="reorder_tasks"),
url(r'^ticket/add/$', views.external_add, name="todo-external-add"),
url(r'^recent/added/$', views.view_list, {'list_slug': 'recent-add'}, name="todo-recently_added"),
url(r'^recent/completed/$', views.view_list, {'list_slug': 'recent-complete'},
name="todo-recently_completed"),
path('ticket/add/', views.external_add, name="external-add"),
path('recent/added/', views.view_list, {'list_slug': 'recent-add'}, name="recently_added"),
path('recent/completed/', views.view_list, {'list_slug': 'recent-complete'}, name="recently_completed"),
]