diff options
Diffstat (limited to 'docs/tutorial/quickstart.md')
| -rw-r--r-- | docs/tutorial/quickstart.md | 38 | 
1 files changed, 19 insertions, 19 deletions
| diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index 8bf8c7f5..029b56a2 100644 --- a/docs/tutorial/quickstart.md +++ b/docs/tutorial/quickstart.md @@ -46,14 +46,14 @@ First up we're going to define some serializers in `quickstart/serializers.py` t      from django.contrib.auth.models import User, Group      from rest_framework import serializers -     -     + +      class UserSerializer(serializers.HyperlinkedModelSerializer):          class Meta:              model = User              fields = ('url', 'username', 'email', 'groups') -     -     + +      class GroupSerializer(serializers.HyperlinkedModelSerializer):          class Meta:              model = Group @@ -68,16 +68,16 @@ Right, we'd better write some views then.  Open `quickstart/views.py` and get ty      from django.contrib.auth.models import User, Group      from rest_framework import viewsets      from quickstart.serializers import UserSerializer, GroupSerializer -     -     + +      class UserViewSet(viewsets.ModelViewSet):          """          API endpoint that allows users to be viewed or edited.          """          queryset = User.objects.all()          serializer_class = UserSerializer -     -     + +      class GroupViewSet(viewsets.ModelViewSet):          """          API endpoint that allows groups to be viewed or edited. @@ -144,22 +144,22 @@ We're now ready to test the API we've built.  Let's fire up the server from the  We can now access our API, both from the command-line, using tools like `curl`... -    bash: curl -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/  +    bash: curl -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/      { -        "count": 2,  -        "next": null,  -        "previous": null,  +        "count": 2, +        "next": null, +        "previous": null,          "results": [              { -                "email": "admin@example.com",  -                "groups": [],  -                "url": "http://127.0.0.1:8000/users/1/",  +                "email": "admin@example.com", +                "groups": [], +                "url": "http://127.0.0.1:8000/users/1/",                  "username": "admin" -            },  +            },              { -                "email": "tom@example.com",  -                "groups": [                ],  -                "url": "http://127.0.0.1:8000/users/2/",  +                "email": "tom@example.com", +                "groups": [                ], +                "url": "http://127.0.0.1:8000/users/2/",                  "username": "tom"              }          ] | 
