From ccb2b8ff691760e4e93f3905975b285cee8b67f8 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Tue, 10 Feb 2015 23:56:05 +0100 Subject: Update documentation --- api-guide/generic-views/index.html | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'api-guide/generic-views/index.html') diff --git a/api-guide/generic-views/index.html b/api-guide/generic-views/index.html index 675220d7..082f0bb0 100644 --- a/api-guide/generic-views/index.html +++ b/api-guide/generic-views/index.html @@ -577,14 +577,10 @@ class UserList(generics.ListCreateAPIView): -

Deprecated attributes:

-

Methods

Base methods:

get_queryset(self)

-

Returns the queryset that should be used for list views, and that should be used as the base for lookups in detail views. Defaults to returning the queryset specified by the queryset attribute, or the default queryset for the model if the model shortcut is being used.

+

Returns the queryset that should be used for list views, and that should be used as the base for lookups in detail views. Defaults to returning the queryset specified by the queryset attribute.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

May be overridden to provide dynamic behavior, such as returning a queryset, that is specific to the user making the request.

For example:

@@ -620,7 +616,7 @@ class UserList(generics.ListCreateAPIView): return (CategoryFilter,)

get_serializer_class(self)

-

Returns the class that should be used for the serializer. Defaults to returning the serializer_class attribute, or dynamically generating a serializer class if the model shortcut is being used.

+

Returns the class that should be used for the serializer. Defaults to returning the serializer_class attribute.

May be overridden to provide dynamic behavior, such as using different serializers for read and write operations, or providing different serializers to different types of users.

For example:

def get_serializer_class(self):
-- 
cgit v1.2.3