diff options
| author | Tom Christie | 2013-06-02 20:12:49 +0100 |
|---|---|---|
| committer | Tom Christie | 2013-06-02 20:12:49 +0100 |
| commit | b15a6ccef2e13ab3310dbe856a945bba56e21c63 (patch) | |
| tree | eedeffadf8f6fa48d339940e8bba64e33b33db7d /docs | |
| parent | 01e80ff9f77c075a01fc84c93f511a8b16ab3045 (diff) | |
| download | django-rest-framework-b15a6ccef2e13ab3310dbe856a945bba56e21c63.tar.bz2 | |
Serializer field 'default' argument may be a callable
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api-guide/fields.md | 4 | ||||
| -rw-r--r-- | docs/topics/release-notes.md | 1 |
2 files changed, 4 insertions, 1 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/topics/release-notes.md b/docs/topics/release-notes.md index 77cd4f9e..6eb18160 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -43,6 +43,7 @@ You can determine your currently installed version using `pip freeze`: ### Master * Added `get_url` hook to `HyperlinkedIdentityField`. +* Serializer field `default` argument may be a callable. * Bugfix: The `lookup_field` option on `HyperlinkedIdentityField` should apply by default to the url field on the serializer. * Bugfix: `HyperlinkedIdentityField` should continue to support `pk_url_kwarg`, `slug_url_kwarg`, `slug_field`, in a pending deprecation state. * Bugfix: Ensure we always return 404 instead of 500 if a lookup field cannot be converted to the correct lookup type. (Eg non-numeric `AutoInteger` pk lookup) |
