From eee582af41c30562af997b5d4dffc75381c1b8ff Mon Sep 17 00:00:00 2001 From: j0hnsmith Date: Sat, 28 Jan 2017 15:23:39 +0000 Subject: [PATCH] add Meta.include which is the same as Meta.fields 'include' is the opposite of 'exclude', feels more natural. --- rest_framework/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index a8f6e9df2..a29e7da81 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -1027,7 +1027,7 @@ class ModelSerializer(Serializer): set of fields, but also takes into account the `Meta.fields` or `Meta.exclude` options if they have been specified. """ - fields = getattr(self.Meta, 'fields', None) + fields = getattr(self.Meta, 'fields', getattr(self.Meta, 'include', None)) exclude = getattr(self.Meta, 'exclude', None) if fields and fields != ALL_FIELDS and not isinstance(fields, (list, tuple)):