Update tutorial serialization page (#7945)

This commit is contained in:
Julian Geißler 2026-02-27 14:44:10 +01:00 committed by GitHub
parent b659c2bf48
commit 40e77f0716
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,7 +15,7 @@ Before we do anything else we'll create a new virtual environment, using [venv].
```bash
python3 -m venv env
source env/bin/activate
source env/bin/activate # On Windows use `env\Scripts\activate`
```
Now that we're inside a virtual environment, we can install our package requirements.
@ -217,6 +217,10 @@ Let's look at refactoring our serializer using the `ModelSerializer` class.
Open the file `snippets/serializers.py` again, and replace the `SnippetSerializer` class with the following.
```python
from rest_framework import serializers
from snippets.models import Snippet
class SnippetSerializer(serializers.ModelSerializer):
class Meta:
model = Snippet
@ -362,9 +366,9 @@ Quit the server with CONTROL-C.
In another terminal window, we can test the server.
We can test our API using [curl][curl] or [httpie][httpie]. Httpie is a user friendly http client that's written in Python. Let's install that.
We can test our API using [curl][curl] or [HTTPie][HTTPie]. HTTPie is a user-friendly http client that's written in Python. Let's install that.
You can install httpie using pip:
You can install HTTPie using pip:
```bash
pip install httpie
@ -436,5 +440,5 @@ We'll see how we can start to improve things in [part 2 of the tutorial][tut-2].
[repo]: https://github.com/encode/rest-framework-tutorial
[venv]: https://docs.python.org/3/library/venv.html
[tut-2]: 2-requests-and-responses.md
[httpie]: https://github.com/httpie/httpie#installation
[HTTPie]: https://github.com/httpie/httpie#installation
[curl]: https://curl.haxx.se/