aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/api-guide/serializers.md9
-rw-r--r--docs/index.md7
-rw-r--r--docs/topics/release-notes.md4
3 files changed, 17 insertions, 3 deletions
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md
index 0cdae1ce..a9589144 100644
--- a/docs/api-guide/serializers.md
+++ b/docs/api-guide/serializers.md
@@ -248,6 +248,15 @@ The default `ModelSerializer` uses primary keys for relationships, but you can a
The `depth` option should be set to an integer value that indicates the depth of relationships that should be traversed before reverting to a flat representation.
+## Specifying which fields should be read-only
+
+You may wish to specify multiple fields as read-only. Instead of adding each field explicitely with the `read_only=True` attribute, you may use the `read_only_fields` Meta option, like so:
+
+ class AccountSerializer(serializers.ModelSerializer):
+ class Meta:
+ model = Account
+ read_only_fields = ('created', 'modified')
+
## Customising the default fields
You can create customized subclasses of `ModelSerializer` that use a different set of default fields for the representation, by overriding various `get_<field_type>_field` methods.
diff --git a/docs/index.md b/docs/index.md
index 1874ec00..fd834540 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -32,7 +32,7 @@ REST framework requires the following:
The following packages are optional:
-* [Markdown][markdown] (2.1.0+) - Markdown support for the self describing API.
+* [Markdown][markdown] (2.1.0+) - Markdown support for the browseable API.
* [PyYAML][yaml] (3.10+) - YAML content-type support.
* [django-filter][django-filter] (master) - Filtering support.
@@ -41,8 +41,9 @@ The following packages are optional:
Install using `pip`, including any optional packages you want...
pip install djangorestframework
- pip install markdown # Recommended if using the browseable API.
- pip install pyyaml # Required for yaml content-type support.
+ pip install markdown # Markdown support for the browseable API.
+ pip install pyyaml # YAML content-type support.
+ pip install -e git+https://github.com/alex/django-filter.git#egg=django-filter # Filtering support
...or clone the project from github.
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index 670332e6..35e8a8b3 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -4,6 +4,10 @@
>
> &mdash; Eric S. Raymond, [The Cathedral and the Bazaar][cite].
+## Master
+
+* Support for `read_only_fields` on `ModelSerializer` classes.
+
## 2.1.2
**Date**: 9th Nov 2012