diff options
| author | Brian Jacobel | 2014-12-13 14:47:11 -0500 | 
|---|---|---|
| committer | Brian Jacobel | 2014-12-13 14:47:11 -0500 | 
| commit | 2d470eef809b119c8c72009c81d652ddbf895e0b (patch) | |
| tree | 087e75859c1a9551d07761c572e92b6c6aab8a04 /docs/api-guide | |
| parent | dd712a1c2620b5dc9ad8eef5ff78ef232feb12e8 (diff) | |
| download | django-rest-framework-2d470eef809b119c8c72009c81d652ddbf895e0b.tar.bz2 | |
Change serializers.Field to serializers.ReadOnlyField for 3.x compatibility
Using this code snippet as-is on DRF 3.0.1 results in a NotImplementedError
being raised for to_representation due to 3.0's changed behavior with
serializers.Field. The code snippet should be updated to use
serializers.ReadOnlyField instead.
Further discussion here:
https://groups.google.com/forum/?fromgroups=#!topic/django-rest-framework/aX8mLT_v3yc
Diffstat (limited to 'docs/api-guide')
| -rw-r--r-- | docs/api-guide/pagination.md | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md index 9b7086c5..83429292 100644 --- a/docs/api-guide/pagination.md +++ b/docs/api-guide/pagination.md @@ -128,7 +128,7 @@ For example, to nest a pair of links labelled 'prev' and 'next', and set the nam      class CustomPaginationSerializer(pagination.BasePaginationSerializer):          links = LinksSerializer(source='*')  # Takes the page object as the source -        total_results = serializers.Field(source='paginator.count') +        total_results = serializers.ReadOnlyField(source='paginator.count')          results_field = 'objects' | 
