diff options
| author | Xavier Ordoquy | 2014-06-23 14:02:45 +0200 |
|---|---|---|
| committer | Xavier Ordoquy | 2014-06-23 14:02:45 +0200 |
| commit | 2489e38a06f575aa144644eee683bd87f20186ef (patch) | |
| tree | fc52fd2280d3ef6d0dc69d53a3771ee5f499ab29 /docs/api-guide/serializers.md | |
| parent | 15c2c58b43a00ec29af99e0478b70eea57560fce (diff) | |
| parent | e11f41ebc4ef088a5849771dfda5a7fba4f82904 (diff) | |
| download | django-rest-framework-2489e38a06f575aa144644eee683bd87f20186ef.tar.bz2 | |
Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
.travis.yml
docs/api-guide/viewsets.md
rest_framework/serializers.py
rest_framework/throttling.py
tests/test_generics.py
tests/test_serializers.py
tox.ini
Diffstat (limited to 'docs/api-guide/serializers.md')
| -rw-r--r-- | docs/api-guide/serializers.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index 7ee060af..cedf1ff7 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -73,8 +73,8 @@ Sometimes when serializing objects, you may not want to represent everything exa If you need to customize the serialized value of a particular field, you can do this by creating a `transform_<fieldname>` method. For example if you needed to render some markdown from a text field: - description = serializers.TextField() - description_html = serializers.TextField(source='description', read_only=True) + description = serializers.CharField() + description_html = serializers.CharField(source='description', read_only=True) def transform_description_html(self, obj, value): from django.contrib.markup.templatetags.markup import markdown @@ -464,7 +464,7 @@ For more specific requirements such as specifying a different lookup for each fi model = Account fields = ('url', 'account_name', 'users', 'created') -## Overiding the URL field behavior +## Overriding the URL field behavior The name of the URL field defaults to 'url'. You can override this globally, by using the `URL_FIELD_NAME` setting. @@ -478,7 +478,7 @@ You can also override this on a per-serializer basis by using the `url_field_nam **Note**: The generic view implementations normally generate a `Location` header in response to successful `POST` requests. Serializers using `url_field_name` option will not have this header automatically included by the view. If you need to do so you will ned to also override the view's `get_success_headers()` method. -You can also overide the URL field's view name and lookup field without overriding the field explicitly, by using the `view_name` and `lookup_field` options, like so: +You can also override the URL field's view name and lookup field without overriding the field explicitly, by using the `view_name` and `lookup_field` options, like so: class AccountSerializer(serializers.HyperlinkedModelSerializer): class Meta: |
