From eacb93d453db25df11c873b50743910101e383cb Mon Sep 17 00:00:00 2001 From: Pavlin Gergov Date: Mon, 20 Feb 2017 11:33:54 +0200 Subject: [PATCH 1/3] Update _not_authenticated's docstring (#4906) --- rest_framework/request.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rest_framework/request.py b/rest_framework/request.py index b4bd2d020..9428708ed 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -353,10 +353,9 @@ class Request(object): def _not_authenticated(self): """ - Return a three-tuple of (authenticator, user, authtoken), representing - an unauthenticated request. + Set authenticator, user & authtoken representing an unauthenticated request. - By default this will be (None, AnonymousUser, None). + Defaults are None, AnonymousUser & None. """ self._authenticator = None From 5986f95c8dd1c9b9172ffa121564cfbee869c532 Mon Sep 17 00:00:00 2001 From: Lanrik Date: Mon, 20 Feb 2017 13:48:19 +0400 Subject: [PATCH 2/3] Rearrange code (#4908) Minor refactor. Move assignment to after `None` check. --- rest_framework/fields.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index f46edef1e..2efe89610 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -1446,11 +1446,11 @@ class FileField(Field): return data def to_representation(self, value): - use_url = getattr(self, 'use_url', api_settings.UPLOADED_FILES_USE_URL) - if not value: return None + use_url = getattr(self, 'use_url', api_settings.UPLOADED_FILES_USE_URL) + if use_url: if not getattr(value, 'url', None): # If the file has not been saved it may not have a URL. From d390762e18484bb82951db4f0ffd7c65dae7a71d Mon Sep 17 00:00:00 2001 From: Vadim Date: Mon, 20 Feb 2017 22:16:27 +0700 Subject: [PATCH 3/3] Add drf-writable-nested package to third-party serializers (#4913) --- docs/api-guide/serializers.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index 75d429eb4..a3f7fdcc1 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -1157,6 +1157,9 @@ The [html-json-forms][html-json-forms] package provides an algorithm and seriali [djangorestframework-queryfields][djangorestframework-queryfields] allows API clients to specify which fields will be sent in the response via inclusion/exclusion query parameters. +## DRF Writable Nested + +The [drf-writable-nested][drf-writable-nested] package provides writable nested model serializer which allows to create/update models with nested related data. [cite]: https://groups.google.com/d/topic/django-users/sVFaOfQi4wY/discussion [relations]: relations.md @@ -1177,3 +1180,4 @@ The [html-json-forms][html-json-forms] package provides an algorithm and seriali [drf-base64]: https://bitbucket.org/levit_scs/drf_base64 [drf-serializer-extensions]: https://github.com/evenicoulddoit/django-rest-framework-serializer-extensions [djangorestframework-queryfields]: http://djangorestframework-queryfields.readthedocs.io/ +[drf-writable-nested]: http://github.com/Brogency/drf-writable-nested