aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/generics.py
diff options
context:
space:
mode:
authorTom Christie2013-04-29 13:20:15 +0100
committerTom Christie2013-04-29 13:20:15 +0100
commit53f9d4a380ee0066cbee8382ae265ea6005d8c88 (patch)
treeb209933584df66f8093a665921fb65b90726eed1 /rest_framework/generics.py
parentd17e2d852fc6ebc738e324b8797d390dc0287d37 (diff)
downloaddjango-rest-framework-53f9d4a380ee0066cbee8382ae265ea6005d8c88.tar.bz2
fields shortcut on views
Diffstat (limited to 'rest_framework/generics.py')
-rw-r--r--rest_framework/generics.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/rest_framework/generics.py b/rest_framework/generics.py
index 972424e6..0b8e4a15 100644
--- a/rest_framework/generics.py
+++ b/rest_framework/generics.py
@@ -44,6 +44,10 @@ class GenericAPIView(views.APIView):
# the explicit style is generally preferred.
model = None
+ # This shortcut may be used instead of setting the `serializer_class`
+ # attribute, although using the explicit style is generally preferred.
+ fields = None
+
# If the `model` shortcut is used instead of `serializer_class`, then the
# serializer class will be constructed using this class as the base.
model_serializer_class = api_settings.DEFAULT_MODEL_SERIALIZER_CLASS
@@ -193,6 +197,7 @@ class GenericAPIView(views.APIView):
class DefaultSerializer(self.model_serializer_class):
class Meta:
model = self.model
+ fields = self.fields
return DefaultSerializer
def get_queryset(self):