Skip to content

Update to Django 2.0 Routing Syntax #6049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/tutorial/6-viewsets-and-routers.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Because we're using `ViewSet` classes rather than `View` classes, we actually do

Here's our re-wired `snippets/urls.py` file.

from django.conf.urls import url, include
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from snippets import views

Expand All @@ -116,7 +116,7 @@ Here's our re-wired `snippets/urls.py` file.

# The API URLs are now determined automatically by the router.
urlpatterns = [
url(r'^', include(router.urls))
path('', include(router.urls)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path should also be imported then instead of url - sorry for missing this earlier.

You can add [ci skip] to not trigger a CI run.

Copy link
Contributor Author

@chrisshyi chrisshyi Jun 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, where would I add the [ci skip]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn, just realized I should've included it in the commit message, already committed...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure, but I don't think non-members/collaborators can issue a [ci skip].

]

Registering the viewsets with the router is similar to providing a urlpattern. We include two arguments - the URL prefix for the views, and the viewset itself.
Expand Down