-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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 browsable-api.md #9509
Update browsable-api.md #9509
Conversation
Deprecated url(), use re_path(). Show imports.
docs/topics/browsable-api.md
Outdated
urlpatterns = [ | ||
# ... | ||
url(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework")) | ||
re_path(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework")) |
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.
This doesn't need to be a regex, path("api-auth/")...
is just fine.
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.
Little note about why i suggested re_path and not path (searching stackoverflow):
re_path() is similar to url() (both have regex support).
path() doesn't. (See Django docs)
But you are right, most of the docs use path()
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.
Added a small note about unnecessary regex.
The documentation uses a deprecated method url(), use re_path() instead. Explicit imports (which were not specified).
Note: Before submitting a code change, please review our contributing guidelines.
Description
Documentation edited: deprecated method correction.