diff options
Diffstat (limited to 'docs/api-guide')
| -rw-r--r-- | docs/api-guide/fields.md | 4 | ||||
| -rw-r--r-- | docs/api-guide/filtering.md | 2 | ||||
| -rw-r--r-- | docs/api-guide/viewsets.md | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index 9820cb40..c7db32ed 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -41,7 +41,9 @@ Defaults to `True`. ### `default` -If set, this gives the default value that will be used for the field if none is supplied. If not set the default behavior is to not populate the attribute at all. +If set, this gives the default value that will be used for the field if none is supplied. If not set the default behavior is to not populate the attribute at all. + +May be set to a function or other callable, in which case the value will be evaluated each time it is used. ### `validators` diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md index 4242f40d..05c997a3 100644 --- a/docs/api-guide/filtering.md +++ b/docs/api-guide/filtering.md @@ -231,7 +231,7 @@ Multiple orderings may also be specified: If an `ordering` attribute is set on the view, this will be used as the default ordering. -Typicaly you'd instead control this by setting `order_by` on the initial queryset, but using the `ordering` parameter on the view allows you to specify the ordering in a way that it can then be passed automatically as context to a rendered template. This makes it possible to automatically render column headers differently if they are being used to order the results. +Typically you'd instead control this by setting `order_by` on the initial queryset, but using the `ordering` parameter on the view allows you to specify the ordering in a way that it can then be passed automatically as context to a rendered template. This makes it possible to automatically render column headers differently if they are being used to order the results. class UserListView(generics.ListAPIView): queryset = User.objects.all() diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index 79364626..2783da98 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -126,6 +126,11 @@ The `@action` and `@link` decorators can additionally take extra arguments that def set_password(self, request, pk=None): ... +The `@action` decorator will route `POST` requests by default, but may also accept other HTTP methods, by using the `method` argument. For example: + + @action(methods=['POST', 'DELETE']) + def unset_password(self, request, pk=None): + ... --- # API Reference |
