Skip to content

Update browsable-api.md #9509

New issue

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

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

Already on GitHub? # to your account

Merged
merged 3 commits into from
Aug 27, 2024
Merged

Update browsable-api.md #9509

merged 3 commits into from
Aug 27, 2024

Conversation

rafaelgramoschi
Copy link
Contributor

@rafaelgramoschi rafaelgramoschi commented Aug 21, 2024

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.

Deprecated url(), use re_path(). Show imports.
urlpatterns = [
# ...
url(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework"))
re_path(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework"))
Copy link
Contributor

@ulgens ulgens Aug 22, 2024

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.

Copy link
Contributor Author

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()

Copy link
Contributor

@ulgens ulgens left a 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.

@auvipy auvipy merged commit f593f57 into encode:master Aug 27, 2024
7 checks passed
@browniebroke browniebroke added this to the 3.16 milestone Jan 16, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants