Skip to content

Commit 041b88f

Browse files
Improve style, fix some typos (#8405)
* Improve style, fix some typos * Update docs/api-guide/fields.md Co-authored-by: Tom Christie <[email protected]> Co-authored-by: Tom Christie <[email protected]>
1 parent e354331 commit 041b88f

32 files changed

+78
-78
lines changed

docs/api-guide/authentication.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ If you've already created some users, you can generate tokens for all existing u
201201

202202
#### By exposing an api endpoint
203203

204-
When using `TokenAuthentication`, you may want to provide a mechanism for clients to obtain a token given the username and password. REST framework provides a built-in view to provide this behaviour. To use it, add the `obtain_auth_token` view to your URLconf:
204+
When using `TokenAuthentication`, you may want to provide a mechanism for clients to obtain a token given the username and password. REST framework provides a built-in view to provide this behavior. To use it, add the `obtain_auth_token` view to your URLconf:
205205

206206
from rest_framework.authtoken import views
207207
urlpatterns += [
@@ -216,7 +216,7 @@ The `obtain_auth_token` view will return a JSON response when valid `username` a
216216

217217
Note that the default `obtain_auth_token` view explicitly uses JSON requests and responses, rather than using default renderer and parser classes in your settings.
218218

219-
By default, there are no permissions or throttling applied to the `obtain_auth_token` view. If you do wish to apply to throttle you'll need to override the view class,
219+
By default, there are no permissions or throttling applied to the `obtain_auth_token` view. If you do wish to apply throttling you'll need to override the view class,
220220
and include them using the `throttle_classes` attribute.
221221

222222
If you need a customized version of the `obtain_auth_token` view, you can do so by subclassing the `ObtainAuthToken` view class, and using that in your url conf instead.
@@ -250,7 +250,7 @@ And in your `urls.py`:
250250

251251
#### With Django admin
252252

253-
It is also possible to create Tokens manually through the admin interface. In case you are using a large user base, we recommend that you monkey patch the `TokenAdmin` class customize it to your needs, more specifically by declaring the `user` field as `raw_field`.
253+
It is also possible to create Tokens manually through the admin interface. In case you are using a large user base, we recommend that you monkey patch the `TokenAdmin` class to customize it to your needs, more specifically by declaring the `user` field as `raw_field`.
254254

255255
`your_app/admin.py`:
256256

@@ -289,7 +289,7 @@ If you're using an AJAX-style API with SessionAuthentication, you'll need to mak
289289

290290
**Warning**: Always use Django's standard login view when creating login pages. This will ensure your login views are properly protected.
291291

292-
CSRF validation in REST framework works slightly differently from standard Django due to the need to support both session and non-session based authentication to the same views. This means that only authenticated requests require CSRF tokens, and anonymous requests may be sent without CSRF tokens. This behaviour is not suitable for login views, which should always have CSRF validation applied.
292+
CSRF validation in REST framework works slightly differently from standard Django due to the need to support both session and non-session based authentication to the same views. This means that only authenticated requests require CSRF tokens, and anonymous requests may be sent without CSRF tokens. This behavior is not suitable for login views, which should always have CSRF validation applied.
293293

294294

295295
## RemoteUserAuthentication
@@ -299,15 +299,15 @@ environment variable.
299299

300300
To use it, you must have `django.contrib.auth.backends.RemoteUserBackend` (or a subclass) in your
301301
`AUTHENTICATION_BACKENDS` setting. By default, `RemoteUserBackend` creates `User` objects for usernames that don't
302-
already exist. To change this and other behaviour, consult the
302+
already exist. To change this and other behavior, consult the
303303
[Django documentation](https://docs.djangoproject.com/en/stable/howto/auth-remote-user/).
304304

305305
If successfully authenticated, `RemoteUserAuthentication` provides the following credentials:
306306

307307
* `request.user` will be a Django `User` instance.
308308
* `request.auth` will be `None`.
309309

310-
Consult your web server's documentation for information about configuring an authentication method, e.g.:
310+
Consult your web server's documentation for information about configuring an authentication method, for example:
311311

312312
* [Apache Authentication How-To](https://httpd.apache.org/docs/2.4/howto/auth.html)
313313
* [NGINX (Restricting Access)](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/)
@@ -418,7 +418,7 @@ HTTP Signature (currently a [IETF draft][http-signature-ietf-draft]) provides a
418418

419419
## Djoser
420420

421-
[Djoser][djoser] library provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. The package works with a custom user model and uses token-based authentication. This is ready to use REST implementation of the Django authentication system.
421+
[Djoser][djoser] library provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. The package works with a custom user model and uses token-based authentication. This is a ready to use REST implementation of the Django authentication system.
422422

423423
## django-rest-auth / dj-rest-auth
424424

docs/api-guide/fields.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Defaults to `True`. If you're using [Model Serializer](https://www.django-rest-f
4646

4747
### `default`
4848

49-
If set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behaviour is to not populate the attribute at all.
49+
If set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behavior is to not populate the attribute at all.
5050

5151
The `default` is not applied during partial update operations. In the partial update case only fields that are provided in the incoming data will have a validated value returned.
5252

@@ -85,7 +85,7 @@ When serializing fields with dotted notation, it may be necessary to provide a `
8585
class CommentSerializer(serializers.Serializer):
8686
email = serializers.EmailField(source="user.email")
8787

88-
would require user object to be fetched from database when it is not prefetched. If that is not wanted, be sure to be using `prefetch_related` and `select_related` methods appropriately. For more information about the methods refer to [django documentation][django-docs-select-related].
88+
This case would require user object to be fetched from database when it is not prefetched. If that is not wanted, be sure to be using `prefetch_related` and `select_related` methods appropriately. For more information about the methods refer to [django documentation][django-docs-select-related].
8989

9090
The value `source='*'` has a special meaning, and is used to indicate that the entire object should be passed through to the field. This can be useful for creating nested representations, or for fields which require access to the complete object in order to determine the output representation.
9191

@@ -151,7 +151,7 @@ Prior to Django 2.1 `models.BooleanField` fields were always `blank=True`. Thus
151151
since Django 2.1 default `serializers.BooleanField` instances will be generated
152152
without the `required` kwarg (i.e. equivalent to `required=True`) whereas with
153153
previous versions of Django, default `BooleanField` instances will be generated
154-
with a `required=False` option. If you want to control this behaviour manually,
154+
with a `required=False` option. If you want to control this behavior manually,
155155
explicitly declare the `BooleanField` on the serializer class, or use the
156156
`extra_kwargs` option to set the `required` flag.
157157

@@ -771,7 +771,7 @@ Here the mapping between the target and source attribute pairs (`x` and
771771
`x_coordinate`, `y` and `y_coordinate`) is handled in the `IntegerField`
772772
declarations. It's our `NestedCoordinateSerializer` that takes `source='*'`.
773773

774-
Our new `DataPointSerializer` exhibits the same behaviour as the custom field
774+
Our new `DataPointSerializer` exhibits the same behavior as the custom field
775775
approach.
776776

777777
Serializing:
@@ -831,7 +831,7 @@ the [djangorestframework-recursive][djangorestframework-recursive] package provi
831831

832832
## django-rest-framework-gis
833833

834-
The [django-rest-framework-gis][django-rest-framework-gis] package provides geographic addons for django rest framework like a `GeometryField` field and a GeoJSON serializer.
834+
The [django-rest-framework-gis][django-rest-framework-gis] package provides geographic addons for django rest framework like a `GeometryField` field and a GeoJSON serializer.
835835

836836
## django-rest-framework-hstore
837837

docs/api-guide/format-suffixes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Returns a URL pattern list which includes format suffix patterns appended to eac
2323
Arguments:
2424

2525
* **urlpatterns**: Required. A URL pattern list.
26-
* **suffix_required**: Optional. A boolean indicating if suffixes in the URLs should be optional or mandatory. Defaults to `False`, meaning that suffixes are optional by default.
27-
* **allowed**: Optional. A list or tuple of valid format suffixes. If not provided, a wildcard format suffix pattern will be used.
26+
* **suffix_required**: Optional. A boolean indicating if suffixes in the URLs should be optional or mandatory. Defaults to `False`, meaning that suffixes are optional by default.
27+
* **allowed**: Optional. A list or tuple of valid format suffixes. If not provided, a wildcard format suffix pattern will be used.
2828

2929
Example:
3030

docs/api-guide/generic-views.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ For example:
9898

9999
---
100100

101-
**Note:** If the serializer_class used in the generic view spans orm relations, leading to an n+1 problem, you could optimize your queryset in this method using `select_related` and `prefetch_related`. To get more information about n+1 problem and use cases of the mentioned methods refer to related section in [django documentation][django-docs-select-related].
101+
**Note:** If the `serializer_class` used in the generic view spans orm relations, leading to an n+1 problem, you could optimize your queryset in this method using `select_related` and `prefetch_related`. To get more information about n+1 problem and use cases of the mentioned methods refer to related section in [django documentation][django-docs-select-related].
102102

103103
---
104104

docs/api-guide/pagination.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Note that the `paginate_queryset` method may set state on the pagination instanc
227227

228228
## Example
229229

230-
Suppose we want to replace the default pagination output style with a modified format that includes the next and previous links under in a nested 'links' key. We could specify a custom pagination class like so:
230+
Suppose we want to replace the default pagination output style with a modified format that includes the next and previous links under in a nested 'links' key. We could specify a custom pagination class like so:
231231

232232
class CustomPagination(pagination.PageNumberPagination):
233233
def get_paginated_response(self, data):

docs/api-guide/parsers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ REST framework includes a number of built in Parser classes, that allow you to a
1515

1616
## How the parser is determined
1717

18-
The set of valid parsers for a view is always defined as a list of classes. When `request.data` is accessed, REST framework will examine the `Content-Type` header on the incoming request, and determine which parser to use to parse the request content.
18+
The set of valid parsers for a view is always defined as a list of classes. When `request.data` is accessed, REST framework will examine the `Content-Type` header on the incoming request, and determine which parser to use to parse the request content.
1919

2020
---
2121

docs/api-guide/permissions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ This permission class ties into Django's standard `django.contrib.auth` [model p
177177
* `PUT` and `PATCH` requests require the user to have the `change` permission on the model.
178178
* `DELETE` requests require the user to have the `delete` permission on the model.
179179

180-
The default behaviour can also be overridden to support custom model permissions. For example, you might want to include a `view` model permission for `GET` requests.
180+
The default behavior can also be overridden to support custom model permissions. For example, you might want to include a `view` model permission for `GET` requests.
181181

182182
To use custom model permissions, override `DjangoModelPermissions` and set the `.perms_map` property. Refer to the source code for details.
183183

docs/api-guide/relations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ When using `SlugRelatedField` as a read-write field, you will normally want to e
246246

247247
## HyperlinkedIdentityField
248248

249-
This field can be applied as an identity relationship, such as the `'url'` field on a HyperlinkedModelSerializer. It can also be used for an attribute on the object. For example, the following serializer:
249+
This field can be applied as an identity relationship, such as the `'url'` field on a HyperlinkedModelSerializer. It can also be used for an attribute on the object. For example, the following serializer:
250250

251251
class AlbumSerializer(serializers.HyperlinkedModelSerializer):
252252
track_listing = serializers.HyperlinkedIdentityField(view_name='track-list')

docs/api-guide/renderers.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The TemplateHTMLRenderer will create a `RequestContext`, using the `response.dat
105105

106106
---
107107

108-
**Note:** When used with a view that makes use of a serializer the `Response` sent for rendering may not be a dictionary and will need to be wrapped in a dict before returning to allow the TemplateHTMLRenderer to render it. For example:
108+
**Note:** When used with a view that makes use of a serializer the `Response` sent for rendering may not be a dictionary and will need to be wrapped in a dict before returning to allow the `TemplateHTMLRenderer` to render it. For example:
109109

110110
```
111111
response.data = {'results': response.data}
@@ -192,7 +192,7 @@ By default the response content will be rendered with the highest priority rende
192192
def get_default_renderer(self, view):
193193
return JSONRenderer()
194194

195-
## AdminRenderer
195+
## AdminRenderer
196196

197197
Renders data into HTML for an admin-like display:
198198

@@ -332,7 +332,7 @@ You can do some pretty flexible things using REST framework's renderers. Some e
332332
* Specify multiple types of HTML representation for API clients to use.
333333
* Underspecify a renderer's media type, such as using `media_type = 'image/*'`, and use the `Accept` header to vary the encoding of the response.
334334

335-
## Varying behaviour by media type
335+
## Varying behavior by media type
336336

337337
In some cases you might want your view to use different serialization styles depending on the accepted media type. If you need to do this you can access `request.accepted_renderer` to determine the negotiated renderer that will be used for the response.
338338

docs/api-guide/requests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If a client sends a request with a content-type that cannot be parsed then a `Un
4949

5050
# Content negotiation
5151

52-
The request exposes some properties that allow you to determine the result of the content negotiation stage. This allows you to implement behaviour such as selecting a different serialization schemes for different media types.
52+
The request exposes some properties that allow you to determine the result of the content negotiation stage. This allows you to implement behavior such as selecting a different serialization schemes for different media types.
5353

5454
## .accepted_renderer
5555

docs/api-guide/reverse.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ You should **include the request as a keyword argument** to the function, for ex
3838
def get(self, request):
3939
year = now().year
4040
data = {
41-
...
41+
...
4242
'year-summary-url': reverse('year-summary', args=[year], request=request)
4343
}
4444
return Response(data)

docs/api-guide/schemas.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -293,15 +293,15 @@ class CustomView(APIView):
293293

294294
This saves you having to create a custom subclass per-view for a commonly used option.
295295

296-
Not all `AutoSchema` methods expose related `__init__()` kwargs, but those for
296+
Not all `AutoSchema` methods expose related `__init__()` kwargs, but those for
297297
the more commonly needed options do.
298298

299299
### `AutoSchema` methods
300300

301301
#### `get_components()`
302302

303303
Generates the OpenAPI components that describe request and response bodies,
304-
deriving their properties from the serializer.
304+
deriving their properties from the serializer.
305305

306306
Returns a dictionary mapping the component name to the generated
307307
representation. By default this has just a single pair but you may override

0 commit comments

Comments
 (0)