From 2d470eef809b119c8c72009c81d652ddbf895e0b Mon Sep 17 00:00:00 2001 From: Brian Jacobel Date: Sat, 13 Dec 2014 14:47:11 -0500 Subject: [PATCH] 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 --- docs/api-guide/pagination.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md index 9b7086c54..834292920 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'