-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Update tutorial to Django 2.0 routing syntax #5964
Conversation
Updated part 1 of the DRF tutorial to use django.urls.path instead of django.conf.urls.url
Looking good, thanks! We'll need this pull request to include all the pages in the tutorial, so that we can update them all at once. (Doesn't matter from our side if you choose to make each of those each as separate commits on this pull request, or add them all at once. We'll squash them into a single commit when we merge this.) |
docs/tutorial/1-serialization.md
Outdated
@@ -275,20 +275,22 @@ We'll also need a view which corresponds to an individual snippet, and can be us | |||
|
|||
Finally we need to wire these views up. Create the `snippets/urls.py` file: | |||
|
|||
from django.conf.urls import url | |||
from django.urls import path | |||
# note that the path function was added in Django 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest we drop these two lines of comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do, I'll try to get through the rest of the tutorial pages in the next two days and update them to the new routing syntax as needed.
Finished updating all tutorial pages to Django 2.0 routing syntax |
Yas! 😄 |
Hi @chrisshyi - I found one last url that was missed: https://github.com/encode/django-rest-framework/blob/master/docs/tutorial/6-viewsets-and-routers.md It's in the "Using Routers" section: # The API URLs are now determined automatically by the router.
urlpatterns = [
url(r'^', include(router.urls))
] |
Thanks @stooj - I've updated the file just now and created a pull request. |
Update tutorial to Django 2.0 routing syntax
Updated part 1 of the DRF tutorial to use django.urls.path instead of
django.conf.urls.url
Description
refs #5963 , updated tutorial part 1 to use Django 2.0 routing syntax.