@@ -138,7 +138,7 @@ Note that the relevant methods have always been private APIs, and the docstrings
...
@@ -138,7 +138,7 @@ Note that the relevant methods have always been private APIs, and the docstrings
## Explict view attributes
## Explict view attributes
The usage of `model` attribute in generic Views is still supported, but it's usage is being discouraged in favour of using explict `queryset` and `serializer_class` attributes.
The usage of `model` attribute in generic Views is still supported, but it's usage is being discouraged in favour of the more explict `queryset` attribute.
For example, the following is now the recommended style for using generic views:
For example, the following is now the recommended style for using generic views:
...
@@ -146,9 +146,9 @@ For example, the following is now the recommended style for using generic views:
...
@@ -146,9 +146,9 @@ For example, the following is now the recommended style for using generic views:
queryset = MyModel.objects.all()
queryset = MyModel.objects.all()
serializer_class = MyModelSerializer
serializer_class = MyModelSerializer
Using explict `queryset` and `serializer_class` attributes makes the functioning of the view more clear than using the shortcut `model` attribute.
Using an explict `queryset` attribute makes the functioning of the view more clear than using the shortcut `model` attribute.
It also makes it the usage of overridden `get_queryset()` or `get_serializer_class()` methods more obvious.
It also makes the usage of an overridden `get_queryset()` method more obvious.