mirror of https://github.com/snachodog/mybuddy.git
Update URL definitions to Django 2.0 style.
This commit is contained in:
parent
183a30b0a3
commit
f2a8cdec2d
10
api/urls.py
10
api/urls.py
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url, include
|
from django.urls import include, path
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
@ -19,7 +19,9 @@ router.register(r'weight', views.WeightViewSet)
|
||||||
app_name = 'api'
|
app_name = 'api'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^api/', include(router.urls)),
|
path('api/', include(router.urls)),
|
||||||
url(r'^api/auth/', include('rest_framework.urls',
|
path('api/auth/', include(
|
||||||
namespace='rest_framework'))
|
'rest_framework.urls',
|
||||||
|
namespace='rest_framework'
|
||||||
|
))
|
||||||
]
|
]
|
||||||
|
|
|
@ -75,7 +75,7 @@ class FormsTestCase(TestCase):
|
||||||
self.assertIsInstance(new_user, User)
|
self.assertIsInstance(new_user, User)
|
||||||
|
|
||||||
params['first_name'] = 'Changed'
|
params['first_name'] = 'Changed'
|
||||||
page = self.c.post('/users/{}/edit'.format(new_user.id), params)
|
page = self.c.post('/users/{}/edit/'.format(new_user.id), params)
|
||||||
self.assertEqual(page.status_code, 302)
|
self.assertEqual(page.status_code, 302)
|
||||||
new_user.refresh_from_db()
|
new_user.refresh_from_db()
|
||||||
self.assertEqual(new_user.first_name, params['first_name'])
|
self.assertEqual(new_user.first_name, params['first_name'])
|
||||||
|
|
|
@ -74,7 +74,7 @@ class ViewsTestCase(TestCase):
|
||||||
self.assertEqual(page.status_code, 200)
|
self.assertEqual(page.status_code, 200)
|
||||||
|
|
||||||
entry = User.objects.first()
|
entry = User.objects.first()
|
||||||
page = self.c.get('/users/{}/edit'.format(entry.id))
|
page = self.c.get('/users/{}/edit/'.format(entry.id))
|
||||||
self.assertEqual(page.status_code, 200)
|
self.assertEqual(page.status_code, 200)
|
||||||
page = self.c.get('/users/{}/delete/'.format(entry.id))
|
page = self.c.get('/users/{}/delete/'.format(entry.id))
|
||||||
self.assertEqual(page.status_code, 200)
|
self.assertEqual(page.status_code, 200)
|
||||||
|
|
|
@ -1,45 +1,63 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url, include
|
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth import views as auth_views
|
from django.contrib.auth import views as auth_views
|
||||||
|
from django.urls import include, path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
app_patterns = [
|
app_patterns = [
|
||||||
url(r'^login/$', auth_views.LoginView.as_view(), name='login'),
|
path('login/', auth_views.LoginView.as_view(), name='login'),
|
||||||
url(r'^logout/$', auth_views.LogoutView.as_view(), name='logout'),
|
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
|
||||||
url('^password_reset/$', auth_views.PasswordResetView.as_view(),
|
path(
|
||||||
name='password_reset',),
|
'password_reset/',
|
||||||
|
auth_views.PasswordResetView.as_view(),
|
||||||
|
name='password_reset'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^$', views.RootRouter.as_view(), name='root-router'),
|
path('', views.RootRouter.as_view(), name='root-router'),
|
||||||
url(r'^welcome/$', views.Welcome.as_view(), name='welcome'),
|
path('welcome/', views.Welcome.as_view(), name='welcome'),
|
||||||
|
|
||||||
url(r'^users/$', views.UserList.as_view(), name='user-list'),
|
path('users/', views.UserList.as_view(), name='user-list'),
|
||||||
url(r'^users/add/$', views.UserAdd.as_view(), name='user-add'),
|
path('users/add/', views.UserAdd.as_view(), name='user-add'),
|
||||||
url(r'^users/(?P<pk>[0-9]+)/edit$', views.UserUpdate.as_view(),
|
path(
|
||||||
name='user-update'),
|
'users/<int:pk>/edit/',
|
||||||
url(r'^users/(?P<pk>[0-9]+)/delete/$', views.UserDelete.as_view(),
|
views.UserUpdate.as_view(),
|
||||||
name='user-delete'),
|
name='user-update'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'users/<int:pk>/delete/',
|
||||||
|
views.UserDelete.as_view(),
|
||||||
|
name='user-delete'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^user/password/$', views.UserPassword.as_view(),
|
path(
|
||||||
name='user-password'),
|
'user/password/',
|
||||||
url(r'^user/reset-api-key/$', views.UserResetAPIKey.as_view(),
|
views.UserPassword.as_view(),
|
||||||
name='user-reset-api-key'),
|
name='user-password'
|
||||||
url(r'^user/settings/$', views.UserSettings.as_view(),
|
),
|
||||||
name='user-settings'),
|
path(
|
||||||
|
'user/reset-api-key/',
|
||||||
|
views.UserResetAPIKey.as_view(),
|
||||||
|
name='user-reset-api-key'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'user/settings/',
|
||||||
|
views.UserSettings.as_view(),
|
||||||
|
name='user-settings'
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
url(r'', include('api.urls', namespace='api')),
|
path('', include('api.urls', namespace='api')),
|
||||||
url(r'', include((app_patterns, 'babybuddy'), namespace='babybuddy')),
|
path('', include((app_patterns, 'babybuddy'), namespace='babybuddy')),
|
||||||
url(r'', include('core.urls', namespace='core')),
|
path('', include('core.urls', namespace='core')),
|
||||||
url(r'', include('dashboard.urls', namespace='dashboard')),
|
path('', include('dashboard.urls', namespace='dashboard')),
|
||||||
url(r'', include('reports.urls', namespace='reports')),
|
path('', include('reports.urls', namespace='reports')),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG: # pragma: no cover
|
if settings.DEBUG: # pragma: no cover
|
||||||
|
|
177
core/urls.py
177
core/urls.py
|
@ -1,80 +1,131 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.urls import path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
app_name = 'core'
|
app_name = 'core'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^children/$', views.ChildList.as_view(), name='child-list'),
|
path('children/', views.ChildList.as_view(), name='child-list'),
|
||||||
url(r'^children/add/$', views.ChildAdd.as_view(), name='child-add'),
|
path('children/add/', views.ChildAdd.as_view(), name='child-add'),
|
||||||
url(r'^children/(?P<slug>[^/.]+)/$', views.ChildDetail.as_view(),
|
path('children/<slug:slug>/', views.ChildDetail.as_view(), name='child'),
|
||||||
name='child'),
|
path(
|
||||||
url(r'^children/(?P<slug>[^/.]+)/edit/$', views.ChildUpdate.as_view(),
|
'children/<slug:slug>/edit/',
|
||||||
name='child-update'),
|
views.ChildUpdate.as_view(),
|
||||||
url(r'^children/(?P<slug>[^/.]+)/delete/$', views.ChildDelete.as_view(),
|
name='child-update'
|
||||||
name='child-delete'),
|
),
|
||||||
|
path(
|
||||||
|
'children/<slug:slug>/delete/',
|
||||||
|
views.ChildDelete.as_view(),
|
||||||
|
name='child-delete'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^changes/$', views.DiaperChangeList.as_view(),
|
path(
|
||||||
name='diaperchange-list'),
|
'changes/',
|
||||||
url(r'^changes/add/$', views.DiaperChangeAdd.as_view(),
|
views.DiaperChangeList.as_view(),
|
||||||
name='diaperchange-add'),
|
name='diaperchange-list'
|
||||||
url(r'^changes/(?P<pk>[0-9]+)/$', views.DiaperChangeUpdate.as_view(),
|
),
|
||||||
name='diaperchange-update'),
|
path(
|
||||||
url(r'^changes/(?P<pk>[0-9]+)/delete/$',
|
'changes/add/',
|
||||||
views.DiaperChangeDelete.as_view(), name='diaperchange-delete'),
|
views.DiaperChangeAdd.as_view(),
|
||||||
|
name='diaperchange-add'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'changes/<int:pk>/',
|
||||||
|
views.DiaperChangeUpdate.as_view(),
|
||||||
|
name='diaperchange-update'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'changes/<int:pk>/delete/',
|
||||||
|
views.DiaperChangeDelete.as_view(),
|
||||||
|
name='diaperchange-delete'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^feedings/$', views.FeedingList.as_view(), name='feeding-list'),
|
path('feedings/', views.FeedingList.as_view(), name='feeding-list'),
|
||||||
url(r'^feedings/add/$', views.FeedingAdd.as_view(), name='feeding-add'),
|
path('feedings/add/', views.FeedingAdd.as_view(), name='feeding-add'),
|
||||||
url(r'^feedings/(?P<pk>[0-9]+)/$', views.FeedingUpdate.as_view(),
|
path(
|
||||||
name='feeding-update'),
|
'feedings/<int:pk>/',
|
||||||
url(r'^feedings/(?P<pk>[0-9]+)/delete/$', views.FeedingDelete.as_view(),
|
views.FeedingUpdate.as_view(),
|
||||||
name='feeding-delete'),
|
name='feeding-update'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'feedings/<int:pk>/delete/',
|
||||||
|
views.FeedingDelete.as_view(),
|
||||||
|
name='feeding-delete'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^notes/$', views.NoteList.as_view(), name='note-list'),
|
path('notes/', views.NoteList.as_view(), name='note-list'),
|
||||||
url(r'^notes/add/$', views.NoteAdd.as_view(), name='note-add'),
|
path('notes/add/', views.NoteAdd.as_view(), name='note-add'),
|
||||||
url(r'^notes/(?P<pk>[0-9]+)/$', views.NoteUpdate.as_view(),
|
path('notes/<int:pk>/', views.NoteUpdate.as_view(), name='note-update'),
|
||||||
name='note-update'),
|
path(
|
||||||
url(r'^notes/(?P<pk>[0-9]+)/delete/$', views.NoteDelete.as_view(),
|
'notes/<int:pk>/delete/',
|
||||||
name='note-delete'),
|
views.NoteDelete.as_view(),
|
||||||
|
name='note-delete'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^sleep/$', views.SleepList.as_view(), name='sleep-list'),
|
path('sleep/', views.SleepList.as_view(), name='sleep-list'),
|
||||||
url(r'^sleep/add/$', views.SleepAdd.as_view(), name='sleep-add'),
|
path('sleep/add/', views.SleepAdd.as_view(), name='sleep-add'),
|
||||||
url(r'^sleep/(?P<pk>[0-9]+)/$', views.SleepUpdate.as_view(),
|
path('sleep/<int:pk>/', views.SleepUpdate.as_view(), name='sleep-update'),
|
||||||
name='sleep-update'),
|
path(
|
||||||
url(r'^sleep/(?P<pk>[0-9]+)/delete/$', views.SleepDelete.as_view(),
|
'sleep/<int:pk>/delete/',
|
||||||
name='sleep-delete'),
|
views.SleepDelete.as_view(),
|
||||||
|
name='sleep-delete'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^timers/$', views.TimerList.as_view(), name='timer-list'),
|
path('timers/', views.TimerList.as_view(), name='timer-list'),
|
||||||
url(r'^timer/add/$', views.TimerAdd.as_view(), name='timer-add'),
|
path('timer/add/', views.TimerAdd.as_view(), name='timer-add'),
|
||||||
url(r'^timer/add/quick/$', views.TimerAddQuick.as_view(),
|
path(
|
||||||
name='timer-add-quick'),
|
'timer/add/quick/',
|
||||||
url(r'^timer/(?P<pk>[0-9]+)/$', views.TimerDetail.as_view(),
|
views.TimerAddQuick.as_view(),
|
||||||
name='timer-detail'),
|
name='timer-add-quick'
|
||||||
url(r'^timer/(?P<pk>[0-9]+)/edit/$', views.TimerUpdate.as_view(),
|
),
|
||||||
name='timer-update'),
|
path('timer/<int:pk>/', views.TimerDetail.as_view(), name='timer-detail'),
|
||||||
url(r'^timer/(?P<pk>[0-9]+)/delete/$', views.TimerDelete.as_view(),
|
path(
|
||||||
name='timer-delete'),
|
'timer/<int:pk>/edit/',
|
||||||
url(r'^timer/(?P<pk>[0-9]+)/stop/$', views.TimerStop.as_view(),
|
views.TimerUpdate.as_view(),
|
||||||
name='timer-stop'),
|
name='timer-update'
|
||||||
url(r'^timer/(?P<pk>[0-9]+)/restart/$', views.TimerRestart.as_view(),
|
),
|
||||||
name='timer-restart'),
|
path(
|
||||||
|
'timer/<int:pk>/delete/',
|
||||||
|
views.TimerDelete.as_view(),
|
||||||
|
name='timer-delete'
|
||||||
|
),
|
||||||
|
path('timer/<int:pk>/stop/', views.TimerStop.as_view(), name='timer-stop'),
|
||||||
|
path(
|
||||||
|
'timer/<int:pk>/restart/',
|
||||||
|
views.TimerRestart.as_view(),
|
||||||
|
name='timer-restart'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^tummy-time/$', views.TummyTimeList.as_view(),
|
path('tummy-time/', views.TummyTimeList.as_view(), name='tummytime-list'),
|
||||||
name='tummytime-list'),
|
path(
|
||||||
url(r'^tummy-time/add/$', views.TummyTimeAdd.as_view(),
|
'tummy-time/add/',
|
||||||
name='tummytime-add'),
|
views.TummyTimeAdd.as_view(),
|
||||||
url(r'^tummy-time/(?P<pk>[0-9]+)/$', views.TummyTimeUpdate.as_view(),
|
name='tummytime-add'
|
||||||
name='tummytime-update'),
|
),
|
||||||
url(r'^tummy-time/(?P<pk>[0-9]+)/delete/$',
|
path(
|
||||||
views.TummyTimeDelete.as_view(), name='tummytime-delete'),
|
'tummy-time/<int:pk>/',
|
||||||
|
views.TummyTimeUpdate.as_view(),
|
||||||
|
name='tummytime-update'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'tummy-time/<int:pk>/delete/',
|
||||||
|
views.TummyTimeDelete.as_view(),
|
||||||
|
name='tummytime-delete'
|
||||||
|
),
|
||||||
|
|
||||||
url(r'^weight/$', views.WeightList.as_view(), name='weight-list'),
|
path('weight/', views.WeightList.as_view(), name='weight-list'),
|
||||||
url(r'^weight/add/$', views.WeightAdd.as_view(), name='weight-add'),
|
path('weight/add/', views.WeightAdd.as_view(), name='weight-add'),
|
||||||
url(r'^weight/(?P<pk>[0-9]+)/$', views.WeightUpdate.as_view(),
|
path(
|
||||||
name='weight-update'),
|
'weight/<int:pk>/',
|
||||||
url(r'^weight/(?P<pk>[0-9]+)/delete/$', views.WeightDelete.as_view(),
|
views.WeightUpdate.as_view(),
|
||||||
name='weight-delete'),
|
name='weight-update'
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'weight/<int:pk>/delete/',
|
||||||
|
views.WeightDelete.as_view(),
|
||||||
|
name='weight-delete'
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.urls import path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
app_name = 'dashboard'
|
app_name = 'dashboard'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^dashboard/$', views.Dashboard.as_view(), name='dashboard'),
|
path('dashboard/', views.Dashboard.as_view(), name='dashboard'),
|
||||||
url(r'^children/(?P<slug>[^/.]+)/dashboard/$',
|
path(
|
||||||
views.ChildDashboard.as_view(), name='dashboard-child'),
|
'children/<slug:slug>/dashboard/',
|
||||||
|
views.ChildDashboard.as_view(),
|
||||||
|
name='dashboard-child'
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,32 +1,41 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.urls import path
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
app_name = 'reports'
|
app_name = 'reports'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^children/(?P<slug>[^/.]+)/reports/changes/lifetimes/$',
|
path(
|
||||||
|
'children/<slug:slug>/reports/changes/lifetimes/',
|
||||||
views.DiaperChangeLifetimesChildReport.as_view(),
|
views.DiaperChangeLifetimesChildReport.as_view(),
|
||||||
name='report-diaperchange-lifetimes-child'),
|
name='report-diaperchange-lifetimes-child'
|
||||||
url(r'^children/(?P<slug>[^/.]+)/reports/changes/types/$',
|
),
|
||||||
|
path(
|
||||||
|
'children/<slug:slug>/reports/changes/types/',
|
||||||
views.DiaperChangeTypesChildReport.as_view(),
|
views.DiaperChangeTypesChildReport.as_view(),
|
||||||
name='report-diaperchange-types-child'),
|
name='report-diaperchange-types-child'
|
||||||
|
),
|
||||||
url(r'^children/(?P<slug>[^/.]+)/reports/feeding/duration/$',
|
path(
|
||||||
|
'children/<slug:slug>/reports/feeding/duration/',
|
||||||
views.FeedingDurationChildReport.as_view(),
|
views.FeedingDurationChildReport.as_view(),
|
||||||
name='report-feeding-duration-child'),
|
name='report-feeding-duration-child'
|
||||||
|
),
|
||||||
url(r'^children/(?P<slug>[^/.]+)/reports/sleep/pattern/$',
|
path(
|
||||||
|
'children/<slug:slug>/reports/sleep/pattern/',
|
||||||
views.SleepPatternChildReport.as_view(),
|
views.SleepPatternChildReport.as_view(),
|
||||||
name='report-sleep-pattern-child'),
|
name='report-sleep-pattern-child'
|
||||||
url(r'^children/(?P<slug>[^/.]+)/reports/sleep/totals/$',
|
),
|
||||||
|
path(
|
||||||
|
'children/<slug:slug>/reports/sleep/totals/',
|
||||||
views.SleepTotalsChildReport.as_view(),
|
views.SleepTotalsChildReport.as_view(),
|
||||||
name='report-sleep-totals-child'),
|
name='report-sleep-totals-child'
|
||||||
|
),
|
||||||
url(r'^children/(?P<slug>[^/.]+)/reports/weight/weight/$',
|
path(
|
||||||
|
'children/<slug:slug>/reports/weight/weight/',
|
||||||
views.WeightWeightChildReoport.as_view(),
|
views.WeightWeightChildReoport.as_view(),
|
||||||
name='report-weight-weight-child'),
|
name='report-weight-weight-child'
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue