-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to use django.urls.path in routing (#634)
- Loading branch information
Showing
6 changed files
with
44 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
from django.conf.urls import url | ||
from django.urls import path | ||
from . import views | ||
|
||
|
||
app_name = 'articles' | ||
urlpatterns = [ | ||
url(r'^$', views.ArticleListView.as_view(), | ||
path('', views.ArticleListView.as_view(), | ||
name="list"), | ||
url(r'^~create$', views.ArticleCreateView.as_view(), | ||
path('~create', views.ArticleCreateView.as_view(), | ||
name="create"), | ||
url(r'^(?P<slug>[\w-]+)$', views.ArticleDetailView.as_view(), | ||
path('<slug:slug>', views.ArticleDetailView.as_view(), | ||
name="details"), | ||
url(r'^(?P<slug>[\w-]+)/~update$', views.ArticleUpdateView.as_view(), | ||
path('<slug:slug>/~update', views.ArticleUpdateView.as_view(), | ||
name="update"), | ||
url(r'^(?P<slug>[\w-]+)/~delete$', views.ArticleDeleteView.as_view(), | ||
path('<slug:slug>/~delete', views.ArticleDeleteView.as_view(), | ||
name="delete"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from guardian.compat import url | ||
from django.urls import path | ||
|
||
from posts import views | ||
|
||
urlpatterns = [ | ||
url(r'^$', views.post_list, name='posts_post_list'), | ||
url(r'^(?P<slug>[-\w]+)/$', views.post_detail, name='posts_post_detail'), | ||
path('', views.post_list, name='posts_post_list'), | ||
path('<slug:slug>', views.post_detail, name='posts_post_detail'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
from guardian.compat import include, url, handler404, handler500 | ||
from guardian.compat import include, handler404, handler500 | ||
from django.conf import settings | ||
from django.urls import path | ||
from django.contrib import admin | ||
from django.contrib.auth.views import LogoutView | ||
|
||
__all__ = ['handler404', 'handler500'] | ||
|
||
|
||
admin.autodiscover() | ||
|
||
urlpatterns = [ | ||
url(r'^admin/', admin.site.urls), | ||
url(r'^logout/$', LogoutView.as_view(next_page='/'), name='logout'), | ||
url(r'^article/', include('articles.urls', namespace='articles')), | ||
url(r'^', include('posts.urls')), | ||
path('admin/', admin.site.urls), | ||
path('logout/', LogoutView.as_view(next_page='/'), name='logout'), | ||
path('article/', include('articles.urls', namespace='articles')), | ||
path('', include('posts.urls')), | ||
] | ||
|
||
if 'grappelli' in settings.INSTALLED_APPS: | ||
urlpatterns += [url(r'^grappelli/', include('grappelli.urls')), ] | ||
urlpatterns += [path('grappelli/', include('grappelli.urls')), ] | ||
|
||
if 'rosetta' in settings.INSTALLED_APPS: | ||
urlpatterns += [url(r'^rosetta/', include('rosetta.urls')), ] | ||
urlpatterns += [path('rosetta/', include('rosetta.urls')), ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters