diff options
| author | Tom Christie | 2013-04-30 08:24:33 +0100 | 
|---|---|---|
| committer | Tom Christie | 2013-04-30 08:24:33 +0100 | 
| commit | 21ae3a66917acf4ea57e8f7940ce1a6823a2ce92 (patch) | |
| tree | bd4cef8d397b6a51ca2eae044b0f042949c92acc /docs/topics/2.3-announcement.md | |
| parent | 81c3b4f250e389c29bdaa7da07c4860e2175136d (diff) | |
| download | django-rest-framework-21ae3a66917acf4ea57e8f7940ce1a6823a2ce92.tar.bz2 | |
Drop out  attribute
Diffstat (limited to 'docs/topics/2.3-announcement.md')
| -rw-r--r-- | docs/topics/2.3-announcement.md | 21 | 
1 files changed, 16 insertions, 5 deletions
diff --git a/docs/topics/2.3-announcement.md b/docs/topics/2.3-announcement.md index 45095582..5ed63f05 100644 --- a/docs/topics/2.3-announcement.md +++ b/docs/topics/2.3-announcement.md @@ -4,7 +4,6 @@ REST framework 2.3 is geared towards making it easier and quicker to build your  ## ViewSets & Routers -**TODO**  ## Easier Serializers @@ -132,13 +131,21 @@ If you've been customizing this behavior, for example perhaps to use `rst` marku  Note that the relevant methods have always been private APIs, and the docstrings called them out as intended to be deprecated.  +## ModelSerializers and reverse relationships  + +The support for adding reverse relationships to the `fields` option on a `ModelSerializer` class means that the `get_related_field` and `get_nested_field` method signatures have now changed. + +In the unlikely event that you're providing a custom serializer class, and implementing these methods you should note the new call signature for both methods is now `(self, model_field, related_model, to_many)`.  For revese relationships `model_field` will be `None`. + +The old-style signature will continue to function but will raise a `PendingDeprecationWarning`.  +  ---  # Other notes -## Explict view attributes +## More explicit style -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. +The usage of `model` attribute in generic Views is still supported, but it's usage is being discouraged in favour of the setting the mode explict `queryset` and `serializer_class` attributes.  For example, the following is now the recommended style for using generic views: @@ -146,9 +153,9 @@ For example, the following is now the recommended style for using generic views:          queryset = MyModel.objects.all()          serializer_class = MyModelSerializer -Using an explict `queryset` attribute makes the functioning of the view more clear than using the shortcut `model` attribute. +Using an explict `queryset` and `serializer_class` attributes makes the functioning of the view more clear than using the shortcut `model` attribute. -It also makes the usage of an overridden `get_queryset()` method more obvious. +It also makes the usage of the `get_queryset()` or `get_serializer_class()` methods more obvious.      class AccountListView(generics.RetrieveAPIView):          serializer_class = MyModelSerializer @@ -167,6 +174,10 @@ It also makes the usage of an overridden `get_queryset()` method more obvious.  The 2.3 release series will be the last series to provide compatiblity with Django 1.3. +## Version 2.2 API changes + +All API changes in 2.2 that previously raised `PendingDeprecationWarning` will now raise a `DeprecationWarning`, which is loud by default. +  ## What comes next?  The plan for the next few months is to concentrate on addressing outstanding tickets.  2.4 is likely to deal with relatively small refinements to the existing API.  | 
