Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/api-guide/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ If the `.authenticate_header()` method is not overridden, the authentication sch

The following example will authenticate any incoming request as the user given by the username in a custom request header named 'X-USERNAME'.

from django.contrib.auth.models import User
from django.contrib.auth.models import User
from rest_framework import authentication
from rest_framework import exceptions

Expand Down
2 changes: 1 addition & 1 deletion docs/api-guide/content-negotiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The default content negotiation class may be set globally, using the `DEFAULT_CO

You can also set the content negotiation used for an individual view, or viewset, using the `APIView` class-based views.

from myapp.negotiation import IgnoreClientContentNegotiation
from myapp.negotiation import IgnoreClientContentNegotiation
from rest_framework.response import Response
from rest_framework.views import APIView

Expand Down
18 changes: 9 additions & 9 deletions docs/api-guide/reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ You should **include the request as a keyword argument** to the function, for ex

from rest_framework.reverse import reverse
from rest_framework.views import APIView
from django.utils.timezone import now

class APIRootView(APIView):
def get(self, request):
year = now().year
data = {
...
'year-summary-url': reverse('year-summary', args=[year], request=request)
from django.utils.timezone import now

class APIRootView(APIView):
def get(self, request):
year = now().year
data = {
...
'year-summary-url': reverse('year-summary', args=[year], request=request)
}
return Response(data)
return Response(data)

## reverse_lazy

Expand Down
10 changes: 5 additions & 5 deletions docs/api-guide/serializers.md
Original file line number Diff line number Diff line change
Expand Up @@ -910,15 +910,15 @@ We can now use this class to serialize single `HighScore` instances:
def high_score(request, pk):
instance = HighScore.objects.get(pk=pk)
serializer = HighScoreSerializer(instance)
return Response(serializer.data)
return Response(serializer.data)

Or use it to serialize multiple instances:

@api_view(['GET'])
def all_high_scores(request):
queryset = HighScore.objects.order_by('-score')
serializer = HighScoreSerializer(queryset, many=True)
return Response(serializer.data)
return Response(serializer.data)

#### Read-write `BaseSerializer` classes

Expand Down Expand Up @@ -949,8 +949,8 @@ Here's a complete example of our previous `HighScoreSerializer`, that's been upd
'player_name': 'May not be more than 10 characters.'
})

# Return the validated values. This will be available as
# the `.validated_data` property.
# Return the validated values. This will be available as
# the `.validated_data` property.
return {
'score': int(score),
'player_name': player_name
Expand Down Expand Up @@ -1189,7 +1189,7 @@ The [drf-writable-nested][drf-writable-nested] package provides writable nested

## DRF Encrypt Content

The [drf-encrypt-content][drf-encrypt-content] package helps you encrypt your data, serialized through ModelSerializer. It also contains some helper functions. Which helps you to encrypt your data.
The [drf-encrypt-content][drf-encrypt-content] package helps you encrypt your data, serialized through ModelSerializer. It also contains some helper functions. Which helps you to encrypt your data.


[cite]: https://groups.google.com/d/topic/django-users/sVFaOfQi4wY/discussion
Expand Down
4 changes: 2 additions & 2 deletions docs/api-guide/throttling.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ The rate descriptions used in `DEFAULT_THROTTLE_RATES` may include `second`, `mi
You can also set the throttling policy on a per-view or per-viewset basis,
using the `APIView` class-based views.

from rest_framework.response import Response
from rest_framework.response import Response
from rest_framework.throttling import UserRateThrottle
from rest_framework.views import APIView
from rest_framework.views import APIView

class ExampleView(APIView):
throttle_classes = [UserRateThrottle]
Expand Down
10 changes: 5 additions & 5 deletions docs/community/3.12-announcement.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ in the URL path.

For example...

Method | Path | Tags
Method | Path | Tags
--------------------------------|-----------------|-------------
`GET`, `PUT`, `PATCH`, `DELETE` | `/users/{id}/` | `['users']`
`GET`, `POST` | `/users/` | `['users']`
`GET`, `PUT`, `PATCH`, `DELETE` | `/orders/{id}/` | `['orders']`
`GET`, `POST` | `/orders/` | `['orders']`
`GET`, `PUT`, `PATCH`, `DELETE` | `/users/{id}/` | `['users']`
`GET`, `POST` | `/users/` | `['users']`
`GET`, `PUT`, `PATCH`, `DELETE` | `/orders/{id}/` | `['orders']`
`GET`, `POST` | `/orders/` | `['orders']`

The tags used for a particular view may also be overridden...

Expand Down