Skip to content

Fix example of explicit format URL (2.4.x). #2672

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

Closed
wants to merge 1 commit into from
Closed
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/2-requests-and-responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Notice that we're no longer explicitly tying our requests or responses to a give

## Adding optional format suffixes to our URLs

To take advantage of the fact that our responses are no longer hardwired to a single content type let's add support for format suffixes to our API endpoints. Using format suffixes gives us URLs that explicitly refer to a given format, and means our API will be able to handle URLs such as [http://example.com/api/items/4.json][json-url].
To take advantage of the fact that our responses are no longer hardwired to a single content type let's add support for format suffixes to our API endpoints. Using format suffixes gives us URLs that explicitly refer to a given format, and means our API will be able to handle URLs such as [http://example.com/api/items/4/.json][json-url].

Start by adding a `format` keyword argument to both of the views, like so.

Expand Down Expand Up @@ -167,7 +167,7 @@ See the [browsable api][browsable-api] topic for more information about the brow

In [tutorial part 3][tut-3], we'll start using class based views, and see how generic views reduce the amount of code we need to write.

[json-url]: http://example.com/api/items/4.json
[json-url]: http://example.com/api/items/4/.json
[devserver]: http://127.0.0.1:8000/snippets/
[browsable-api]: ../topics/browsable-api.md
[tut-1]: 1-serialization.md
Expand Down