diff options
| author | Tom Christie | 2013-01-29 09:15:08 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-01-29 09:15:16 +0000 |
| commit | 1929159db1b45ef28d1f7fdf0bea9d0867af13f3 (patch) | |
| tree | 3ff1d7c0ba3a4a6e2245911250c2ad8fc8f9e4ee /docs/api-guide/serializers.md | |
| parent | 5f065153c31b586ca058deb8f6bd48303e3628e5 (diff) | |
| download | django-rest-framework-1929159db1b45ef28d1f7fdf0bea9d0867af13f3.tar.bz2 | |
Docs tweaks.
Diffstat (limited to 'docs/api-guide/serializers.md')
| -rw-r--r-- | docs/api-guide/serializers.md | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index d98a602f..487502e9 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -190,18 +190,12 @@ By default field values are treated as mapping to an attribute on the object. I As an example, let's create a field that can be used represent the class name of the object being serialized: - class ClassNameField(serializers.WritableField): + class ClassNameField(serializers.Field): def field_to_native(self, obj, field_name): """ - Serialize the object's class name, not an attribute of the object. + Serialize the object's class name. """ - return obj.__class__.__name__ - - def field_from_native(self, data, field_name, into): - """ - We don't want to set anything when we revert this field. - """ - pass + return obj.__class__ --- |
