From 32a0b62508fc6a83bc7fd80d362d67ca35b603f9 Mon Sep 17 00:00:00 2001 From: Lim H Date: Sat, 12 Aug 2017 18:59:03 +0100 Subject: [PATCH 01/88] Fix introspection of list field in schema --- rest_framework/schemas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/schemas.py b/rest_framework/schemas.py index 875f9454b..437413355 100644 --- a/rest_framework/schemas.py +++ b/rest_framework/schemas.py @@ -30,7 +30,7 @@ def field_to_schema(field): title = force_text(field.label) if field.label else '' description = force_text(field.help_text) if field.help_text else '' - if isinstance(field, serializers.ListSerializer): + if isinstance(field, (serializers.ListSerializer, serializers.ListField)): child_schema = field_to_schema(field.child) return coreschema.Array( items=child_schema, From ed38371c3ad16ab3a7f4d5c89bb80c1d842dbc56 Mon Sep 17 00:00:00 2001 From: Woile Date: Tue, 15 Aug 2017 16:59:50 +0200 Subject: [PATCH 02/88] Fix docs multiple nested and multiple methods --- .../rest_framework/docs/document.html | 2 +- .../rest_framework/docs/sidebar.html | 2 +- rest_framework/templatetags/rest_framework.py | 23 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/rest_framework/templates/rest_framework/docs/document.html b/rest_framework/templates/rest_framework/docs/document.html index 274eee4e3..7a438f68d 100644 --- a/rest_framework/templates/rest_framework/docs/document.html +++ b/rest_framework/templates/rest_framework/docs/document.html @@ -20,7 +20,7 @@ {% endif %} - {% for link_key, link in section.links|items %} + {% for link_key, link in section|schema_links|items %} {% include "rest_framework/docs/link.html" %} {% endfor %} {% endfor %} diff --git a/rest_framework/templates/rest_framework/docs/sidebar.html b/rest_framework/templates/rest_framework/docs/sidebar.html index 7e20e2485..c4eaa120b 100644 --- a/rest_framework/templates/rest_framework/docs/sidebar.html +++ b/rest_framework/templates/rest_framework/docs/sidebar.html @@ -10,7 +10,7 @@ From a1546cc26633b748dd5c79c9dc222ff84b79d43e Mon Sep 17 00:00:00 2001 From: Woile Date: Thu, 17 Aug 2017 21:14:26 +0200 Subject: [PATCH 05/88] [NEW] Tests for templatetags.schema_links --- rest_framework/templatetags/rest_framework.py | 2 +- tests/test_templatetags.py | 315 +++++++++++++++++- 2 files changed, 315 insertions(+), 2 deletions(-) diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index 5fd189548..a2ee5ccdd 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -249,7 +249,7 @@ def schema_links(section, sec_key=None): """ Recursively find every link in a schema, even nested. """ - NESTED_FORMAT = '%s > %s' + NESTED_FORMAT = '%s > %s' # this format is used in docs/js/api.js:normalizeKeys links = section.links if section.data: data = section.data.items() diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py index 87d5cbc81..dfbd5d9de 100644 --- a/tests/test_templatetags.py +++ b/tests/test_templatetags.py @@ -1,13 +1,16 @@ # encoding: utf-8 from __future__ import unicode_literals +import unittest + from django.test import TestCase +from rest_framework.compat import coreapi, coreschema from rest_framework.relations import Hyperlink from rest_framework.templatetags import rest_framework from rest_framework.templatetags.rest_framework import ( add_nested_class, add_query_param, as_string, break_long_headers, - format_value, get_pagination_html, urlize_quoted_links + format_value, get_pagination_html, schema_links, urlize_quoted_links ) from rest_framework.test import APIRequestFactory @@ -300,3 +303,313 @@ class URLizerTests(TestCase): data['"foo_set": [\n "http://api/foos/1/"\n], '] = \ '"foo_set": [\n "http://api/foos/1/"\n], ' self._urlize_dict_check(data) + + +@unittest.skipUnless(coreapi, 'coreapi is not installed') +class SchemaLinksTests(TestCase): + + def test_schema_with_empty_links(self): + schema = coreapi.Document( + url='', + title='Example API', + content={ + 'users': { + 'list': {} + } + } + ) + section = schema['users'] + flat_links = schema_links(section) + assert len(flat_links) is 0 + + def test_single_action(self): + schema = coreapi.Document( + url='', + title='Example API', + content={ + 'users': { + 'list': coreapi.Link( + url='/users/', + action='get', + fields=[] + ) + } + } + ) + section = schema['users'] + flat_links = schema_links(section) + assert len(flat_links) is 1 + assert 'list' in flat_links + + def test_default_actions(self): + schema = coreapi.Document( + url='', + title='Example API', + content={ + 'users': { + 'create': coreapi.Link( + url='/users/', + action='post', + fields=[] + ), + 'list': coreapi.Link( + url='/users/', + action='get', + fields=[] + ), + 'read': coreapi.Link( + url='/users/{id}/', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ), + 'update': coreapi.Link( + url='/users/{id}/', + action='patch', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + } + } + ) + section = schema['users'] + flat_links = schema_links(section) + assert len(flat_links) is 4 + assert 'list' in flat_links + assert 'create' in flat_links + assert 'read' in flat_links + assert 'update' in flat_links + + def test_default_actions_and_single_custom_action(self): + schema = coreapi.Document( + url='', + title='Example API', + content={ + 'users': { + 'create': coreapi.Link( + url='/users/', + action='post', + fields=[] + ), + 'list': coreapi.Link( + url='/users/', + action='get', + fields=[] + ), + 'read': coreapi.Link( + url='/users/{id}/', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ), + 'update': coreapi.Link( + url='/users/{id}/', + action='patch', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ), + 'friends': coreapi.Link( + url='/users/{id}/friends', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + } + } + ) + section = schema['users'] + flat_links = schema_links(section) + assert len(flat_links) is 5 + assert 'list' in flat_links + assert 'create' in flat_links + assert 'read' in flat_links + assert 'update' in flat_links + assert 'friends' in flat_links + + def test_default_actions_and_single_custom_action_two_methods(self): + schema = coreapi.Document( + url='', + title='Example API', + content={ + 'users': { + 'create': coreapi.Link( + url='/users/', + action='post', + fields=[] + ), + 'list': coreapi.Link( + url='/users/', + action='get', + fields=[] + ), + 'read': coreapi.Link( + url='/users/{id}/', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ), + 'update': coreapi.Link( + url='/users/{id}/', + action='patch', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ), + 'friends': { + 'list': coreapi.Link( + url='/users/{id}/friends', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ), + 'create': coreapi.Link( + url='/users/{id}/friends', + action='post', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + } + } + } + ) + section = schema['users'] + flat_links = schema_links(section) + assert len(flat_links) is 6 + assert 'list' in flat_links + assert 'create' in flat_links + assert 'read' in flat_links + assert 'update' in flat_links + assert 'friends > list' in flat_links + assert 'friends > create' in flat_links + + def test_multiple_nested_routes(self): + schema = coreapi.Document( + url='', + title='Example API', + content={ + 'animals': { + 'dog': { + 'vet': { + 'list': coreapi.Link( + url='/animals/dog/{id}/vet', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + }, + 'read': coreapi.Link( + url='/animals/dog/{id}', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + }, + 'cat': { + 'list': coreapi.Link( + url='/animals/cat/', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ), + 'create': coreapi.Link( + url='/aniamls/cat', + action='post', + fields=[] + ) + } + } + } + ) + section = schema['animals'] + flat_links = schema_links(section) + assert len(flat_links) is 4 + assert 'cat > create' in flat_links + assert 'cat > list' in flat_links + assert 'dog > read' in flat_links + assert 'dog > vet > list' in flat_links + + def test_multiple_resources_with_multiple_nested_routes(self): + schema = coreapi.Document( + url='', + title='Example API', + content={ + 'animals': { + 'dog': { + 'vet': { + 'list': coreapi.Link( + url='/animals/dog/{id}/vet', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + }, + 'read': coreapi.Link( + url='/animals/dog/{id}', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + }, + 'cat': { + 'list': coreapi.Link( + url='/animals/cat/', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ), + 'create': coreapi.Link( + url='/aniamls/cat', + action='post', + fields=[] + ) + } + }, + 'farmers': { + 'silo': { + 'soy': { + 'list': coreapi.Link( + url='/farmers/silo/{id}/soy', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + }, + 'list': coreapi.Link( + url='/farmers/silo', + action='get', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + ] + ) + } + } + } + ) + section = schema['animals'] + flat_links = schema_links(section) + assert len(flat_links) is 4 + assert 'cat > create' in flat_links + assert 'cat > list' in flat_links + assert 'dog > read' in flat_links + assert 'dog > vet > list' in flat_links + + section = schema['farmers'] + flat_links = schema_links(section) + assert len(flat_links) is 2 + assert 'silo > list' in flat_links + assert 'silo > soy > list' in flat_links From c868378c71d7bd9883c1448977e185b1cd7c756c Mon Sep 17 00:00:00 2001 From: kycool Date: Fri, 18 Aug 2017 12:12:01 +0800 Subject: [PATCH 06/88] Update fields.py modify to_choices_dict document --- rest_framework/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 9cc9ab03f..242d0f978 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -142,7 +142,7 @@ def to_choices_dict(choices): to_choices_dict([1]) -> {1: 1} to_choices_dict([(1, '1st'), (2, '2nd')]) -> {1: '1st', 2: '2nd'} - to_choices_dict([('Group', ((1, '1st'), 2))]) -> {'Group': {1: '1st', 2: '2nd'}} + to_choices_dict([('Group', ((1, '1st'), 2))]) -> {'Group': {1: '1st', 2: '2'}} """ # Allow single, paired or grouped choices style: # choices = [1, 2, 3] From 56021f9e7769138e0ae69115f01ed45b5bc8be3f Mon Sep 17 00:00:00 2001 From: Lim H Date: Sun, 20 Aug 2017 17:12:56 +0100 Subject: [PATCH 07/88] Add tests for list field to schema --- tests/test_schemas.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 2b8673480..b435dfdd7 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -39,6 +39,11 @@ class ExampleSerializer(serializers.Serializer): hidden = serializers.HiddenField(default='hello') +class AnotherSerializerWithListFields(serializers.Serializer): + a = serializers.ListField(child=serializers.IntegerField()) + b = serializers.ListSerializer(child=serializers.CharField()) + + class AnotherSerializer(serializers.Serializer): c = serializers.CharField(required=True) d = serializers.CharField(required=False) @@ -57,6 +62,13 @@ class ExampleViewSet(ModelViewSet): """ return super(ExampleSerializer, self).retrieve(self, request) + @detail_route(methods=['post'], serializer_class=AnotherSerializerWithListFields) + def custom_action_with_list_fields(self, request, pk): + """ + A custom action using both list field and list serializer in the serializer. + """ + return super(ExampleSerializer, self).retrieve(self, request) + @list_route() def custom_list_action(self, request): return super(ExampleViewSet, self).list(self, request) @@ -174,6 +186,17 @@ class TestRouterGeneratedSchema(TestCase): coreapi.Field('d', required=False, location='form', schema=coreschema.String(title='D')), ] ), + 'custom_action_with_list_fields': coreapi.Link( + url='/example/{id}/custom_action_with_list_fields/', + action='post', + encoding='application/json', + description='A custom action using both list field and list serializer in the serializer.', + fields=[ + coreapi.Field('id', required=True, location='path', schema=coreschema.String()), + coreapi.Field('a', required=True, location='form', schema=coreschema.Array(title='A', items=coreschema.Integer())), + coreapi.Field('b', required=True, location='form', schema=coreschema.Array(title='B', items=coreschema.String())), + ] + ), 'custom_list_action': coreapi.Link( url='/example/custom_list_action/', action='get' From 81527a2863cbac78acf392f081df2e7868ea285b Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 21 Aug 2017 11:50:00 +0200 Subject: [PATCH 08/88] Release notes for 3.6.4 --- docs/topics/release-notes.md | 59 +++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 7bdd7b0b1..f4a83324c 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -40,6 +40,34 @@ You can determine your currently installed version using `pip freeze`: ## 3.6.x series +### 3.6.4 + +**Date**: [21st August 2017][3.6.4-milestone] + +* Ignore any invalidly formed query parameters for OrderingFilter. [#5131][gh5131] +* Improve memory footprint when reading large JSON requests. [#5147][gh5147] +* Fix schema generation for pagination. [#5161][gh5161] +* Fix exception when `HTML_CUTOFF` is set to `None`. [#5174][gh5174] +* Fix browsable API not supporting `multipart/form-data` correctly. [#5176][gh5176] +* Fixed `test_hyperlinked_related_lookup_url_encoded_exists`. [#5179][gh5179] +* Make sure max_length is in FileField kwargs. [#5186][gh5186] +* Fix `list_route` & `detail_route` with kwargs contains curly bracket in `url_path` [#5187][gh5187] +* Add Django manage command to create a DRF user Token. [#5188][gh5188] +* Ensure API documentation templates do not check for user authentication [#5162][gh5162] +* Fix special case where OneToOneField is also primary key. [#5192][gh5192] +* Added aria-label and a new region for accessibility purposes in base.html [#5196][gh5196] +* Quote nested API parameters in api.js. [#5214][gh5214] +* Set ViewSet args/kwargs/request before dispatch. [#5229][gh5229] +* Added unicode support to SlugField. [#5231][gh5231] +* Fix HiddenField appears in Raw Data form initial content. [#5259][gh5259] +* Raise validation error on invalid timezone parsing. [#5261][gh5261] +* Fix SearchFilter to-many behavior/performance. [#5264][gh5264] +* Simplified chained comparisons and minor code fixes. [#5276][gh5276] +* RemoteUserAuthentication, docs, and tests. [#5306][gh5306] +* Revert "Cached the field's root and context property" [#5313][gh5313] +* Fix introspection of list field in schema. [#5326][gh5326] +* Fix interactive docs for multiple nested and extra methods. [#5334][gh5334] + ### 3.6.3 **Date**: [12th May 2017][3.6.3-milestone] @@ -716,6 +744,7 @@ For older release notes, [please see the version 2.x documentation][old-release- [3.6.1-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.1+Release%22 [3.6.2-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.2+Release%22 [3.6.3-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.3+Release%22 +[3.6.4-milestone]: https://github.com/encode/django-rest-framework/issues?q=milestone%3A%223.6.4+Release%22 [gh2013]: https://github.com/encode/django-rest-framework/issues/2013 @@ -1326,8 +1355,8 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh4955]: https://github.com/encode/django-rest-framework/issues/4955 [gh4956]: https://github.com/encode/django-rest-framework/issues/4956 [gh4949]: https://github.com/encode/django-rest-framework/issues/4949 - + [gh5126]: https://github.com/encode/django-rest-framework/issues/5126 [gh5085]: https://github.com/encode/django-rest-framework/issues/5085 [gh4437]: https://github.com/encode/django-rest-framework/issues/4437 @@ -1360,3 +1389,31 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh4968]: https://github.com/encode/django-rest-framework/issues/4968 [gh5089]: https://github.com/encode/django-rest-framework/issues/5089 [gh5117]: https://github.com/encode/django-rest-framework/issues/5117 + + +[gh5334]: https://github.com/encode/django-rest-framework/issues/5334 +[gh5326]: https://github.com/encode/django-rest-framework/issues/5326 +[gh5313]: https://github.com/encode/django-rest-framework/issues/5313 +[gh5306]: https://github.com/encode/django-rest-framework/issues/5306 +[gh5276]: https://github.com/encode/django-rest-framework/issues/5276 +[gh5264]: https://github.com/encode/django-rest-framework/issues/5264 +[gh5261]: https://github.com/encode/django-rest-framework/issues/5261 +[gh5259]: https://github.com/encode/django-rest-framework/issues/5259 +[gh5231]: https://github.com/encode/django-rest-framework/issues/5231 +[gh5229]: https://github.com/encode/django-rest-framework/issues/5229 +[gh5214]: https://github.com/encode/django-rest-framework/issues/5214 +[gh5196]: https://github.com/encode/django-rest-framework/issues/5196 +[gh5192]: https://github.com/encode/django-rest-framework/issues/5192 +[gh5162]: https://github.com/encode/django-rest-framework/issues/5162 +[gh5188]: https://github.com/encode/django-rest-framework/issues/5188 +[gh5187]: https://github.com/encode/django-rest-framework/issues/5187 +[gh5186]: https://github.com/encode/django-rest-framework/issues/5186 +[gh5179]: https://github.com/encode/django-rest-framework/issues/5179 +[gh5176]: https://github.com/encode/django-rest-framework/issues/5176 +[gh5174]: https://github.com/encode/django-rest-framework/issues/5174 +[gh5161]: https://github.com/encode/django-rest-framework/issues/5161 +[gh5147]: https://github.com/encode/django-rest-framework/issues/5147 +[gh5131]: https://github.com/encode/django-rest-framework/issues/5131 + + + From 68d818fcc72b15851f1427296f7a4ed57cb4524e Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 21 Aug 2017 12:02:14 +0200 Subject: [PATCH 09/88] Update content from Transifex --- .../locale/ar/LC_MESSAGES/django.po | 23 +- .../locale/ca/LC_MESSAGES/django.po | 2 +- .../locale/cs/LC_MESSAGES/django.po | 2 +- .../locale/da/LC_MESSAGES/django.po | 28 +- .../locale/de/LC_MESSAGES/django.po | 28 +- .../locale/el/LC_MESSAGES/django.po | 2 +- .../locale/es/LC_MESSAGES/django.po | 11 +- .../locale/et/LC_MESSAGES/django.po | 2 +- .../locale/fi/LC_MESSAGES/django.po | 30 +- .../locale/fr/LC_MESSAGES/django.po | 10 +- .../locale/hu/LC_MESSAGES/django.po | 2 +- .../locale/it/LC_MESSAGES/django.po | 2 +- .../locale/ja/LC_MESSAGES/django.po | 13 +- .../locale/ko_KR/LC_MESSAGES/django.po | 35 +- .../locale/lv/LC_MESSAGES/django.po | 440 ++++++++++++++++++ .../locale/mk/LC_MESSAGES/django.po | 58 +-- .../locale/nb/LC_MESSAGES/django.po | 2 +- .../locale/nl/LC_MESSAGES/django.po | 15 +- .../locale/pl/LC_MESSAGES/django.po | 13 +- .../locale/pt_BR/LC_MESSAGES/django.po | 2 +- .../locale/ro/LC_MESSAGES/django.po | 2 +- .../locale/ru/LC_MESSAGES/django.po | 25 +- .../locale/sk/LC_MESSAGES/django.po | 2 +- .../locale/sl/LC_MESSAGES/django.po | 440 ++++++++++++++++++ .../locale/sv/LC_MESSAGES/django.po | 10 +- .../locale/tr/LC_MESSAGES/django.po | 4 +- .../locale/tr_TR/LC_MESSAGES/django.po | 4 +- .../locale/uk/LC_MESSAGES/django.po | 11 +- .../locale/zh_CN/LC_MESSAGES/django.po | 18 +- .../locale/zh_Hans/LC_MESSAGES/django.po | 29 +- 30 files changed, 1078 insertions(+), 187 deletions(-) create mode 100644 rest_framework/locale/lv/LC_MESSAGES/django.po create mode 100644 rest_framework/locale/sl/LC_MESSAGES/django.po diff --git a/rest_framework/locale/ar/LC_MESSAGES/django.po b/rest_framework/locale/ar/LC_MESSAGES/django.po index 314356654..ea53a2905 100644 --- a/rest_framework/locale/ar/LC_MESSAGES/django.po +++ b/rest_framework/locale/ar/LC_MESSAGES/django.po @@ -3,15 +3,16 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: -# Bashar Al-Abdulhadi, 2016 +# aymen chaieb , 2017 +# Bashar Al-Abdulhadi, 2016-2017 # Eyad Toma , 2015 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-15 17:08+0000\n" +"Last-Translator: aymen chaieb \n" "Language-Team: Arabic (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ar/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -54,7 +55,7 @@ msgstr "" #: authentication.py:195 msgid "Invalid token." -msgstr "رمز غير صحيح" +msgstr "رمز غير صحيح." #: authtoken/apps.py:7 msgid "Auth Token" @@ -316,15 +317,15 @@ msgstr "أرسل" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "تصاعدي" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "تنازلي" #: pagination.py:193 msgid "Invalid page." -msgstr "صفحة غير صحيحة" +msgstr "صفحة غير صحيحة." #: pagination.py:427 msgid "Invalid cursor" @@ -382,13 +383,13 @@ msgstr "الترتيب" #: templates/rest_framework/filters/search.html:2 msgid "Search" -msgstr "البحث" +msgstr "بحث" #: templates/rest_framework/horizontal/radio.html:2 #: templates/rest_framework/inline/radio.html:2 #: templates/rest_framework/vertical/radio.html:2 msgid "None" -msgstr "" +msgstr "لا شيء" #: templates/rest_framework/horizontal/select_multiple.html:2 #: templates/rest_framework/inline/select_multiple.html:2 @@ -398,7 +399,7 @@ msgstr "" #: validators.py:43 msgid "This field must be unique." -msgstr "" +msgstr "هذا الحقل يجب أن يكون وحيد" #: validators.py:97 msgid "The fields {field_names} must make a unique set." @@ -438,4 +439,4 @@ msgstr "" #: views.py:88 msgid "Permission denied." -msgstr "" +msgstr "حق غير مصرح به" diff --git a/rest_framework/locale/ca/LC_MESSAGES/django.po b/rest_framework/locale/ca/LC_MESSAGES/django.po index 56f46319f..f82de0068 100644 --- a/rest_framework/locale/ca/LC_MESSAGES/django.po +++ b/rest_framework/locale/ca/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Catalan (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ca/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/cs/LC_MESSAGES/django.po b/rest_framework/locale/cs/LC_MESSAGES/django.po index 8ba979350..b6ee1ea48 100644 --- a/rest_framework/locale/cs/LC_MESSAGES/django.po +++ b/rest_framework/locale/cs/LC_MESSAGES/django.po @@ -10,7 +10,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Czech (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/cs/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/da/LC_MESSAGES/django.po b/rest_framework/locale/da/LC_MESSAGES/django.po index 2903376ad..900695649 100644 --- a/rest_framework/locale/da/LC_MESSAGES/django.po +++ b/rest_framework/locale/da/LC_MESSAGES/django.po @@ -3,15 +3,15 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: -# Mads Jensen , 2015-2016 +# Mads Jensen , 2015-2017 # Mikkel Munch Mortensen <3xm@detfalskested.dk>, 2015 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Mads Jensen \n" "Language-Team: Danish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -62,31 +62,31 @@ msgstr "" #: authtoken/models.py:15 msgid "Key" -msgstr "" +msgstr "Nøgle" #: authtoken/models.py:18 msgid "User" -msgstr "" +msgstr "Bruger" #: authtoken/models.py:20 msgid "Created" -msgstr "" +msgstr "Oprettet" #: authtoken/models.py:29 msgid "Token" -msgstr "" +msgstr "Token" #: authtoken/models.py:30 msgid "Tokens" -msgstr "" +msgstr "Tokens" #: authtoken/serializers.py:8 msgid "Username" -msgstr "" +msgstr "Brugernavn" #: authtoken/serializers.py:9 msgid "Password" -msgstr "" +msgstr "Kodeord" #: authtoken/serializers.py:20 msgid "User account is disabled." @@ -316,15 +316,15 @@ msgstr "Indsend." #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "stigende" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "faldende" #: pagination.py:193 msgid "Invalid page." -msgstr "" +msgstr "Ugyldig side" #: pagination.py:427 msgid "Invalid cursor" @@ -426,7 +426,7 @@ msgstr "Ugyldig version i URL-stien." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "Ugyldig version in URLen. Den stemmer ikke overens med nogen versionsnumre." #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/de/LC_MESSAGES/django.po b/rest_framework/locale/de/LC_MESSAGES/django.po index 057a69f1c..725a0f757 100644 --- a/rest_framework/locale/de/LC_MESSAGES/django.po +++ b/rest_framework/locale/de/LC_MESSAGES/django.po @@ -4,6 +4,8 @@ # # Translators: # Fabian Büchler , 2015 +# datKater , 2017 +# Lukas Bischofberger , 2017 # Mads Jensen , 2015 # Niklas P , 2015-2016 # Thomas Tanner, 2015 @@ -14,8 +16,8 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Lukas Bischofberger \n" "Language-Team: German (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -74,7 +76,7 @@ msgstr "Benutzer" #: authtoken/models.py:20 msgid "Created" -msgstr "" +msgstr "Erzeugt" #: authtoken/models.py:29 msgid "Token" @@ -98,7 +100,7 @@ msgstr "Benutzerkonto ist gesperrt." #: authtoken/serializers.py:23 msgid "Unable to log in with provided credentials." -msgstr "Kann nicht mit den angegeben Zugangsdaten anmelden." +msgstr "Die angegebenen Zugangsdaten stimmen nicht." #: authtoken/serializers.py:26 msgid "Must include \"username\" and \"password\"." @@ -122,7 +124,7 @@ msgstr "Anmeldedaten fehlen." #: exceptions.py:99 msgid "You do not have permission to perform this action." -msgstr "Sie sind nicht berechtigt, diese Aktion durchzuführen." +msgstr "Sie sind nicht berechtigt diese Aktion durchzuführen." #: exceptions.py:104 views.py:81 msgid "Not found." @@ -151,7 +153,7 @@ msgstr "Dieses Feld ist erforderlich." #: fields.py:270 msgid "This field may not be null." -msgstr "Dieses Feld darf nicht Null sein." +msgstr "Dieses Feld darf nicht null sein." #: fields.py:608 fields.py:639 msgid "\"{input}\" is not a valid boolean." @@ -193,7 +195,7 @@ msgstr "\"{value}\" ist keine gültige UUID." #: fields.py:796 msgid "Enter a valid IPv4 or IPv6 address." -msgstr "Geben Sie eine gültige UPv4 oder IPv6 Adresse an" +msgstr "Geben Sie eine gültige IPv4 oder IPv6 Adresse an" #: fields.py:821 msgid "A valid integer is required." @@ -272,7 +274,7 @@ msgstr "Diese Auswahl darf nicht leer sein" #: fields.py:1339 msgid "\"{input}\" is not a valid path choice." -msgstr "\"{input}\" ist ein ungültiger Pfad Wahl." +msgstr "\"{input}\" ist ein ungültiger Pfad." #: fields.py:1358 msgid "No file was submitted." @@ -308,7 +310,7 @@ msgstr "Diese Liste darf nicht leer sein." #: fields.py:1502 msgid "Expected a dictionary of items but got type \"{input_type}\"." -msgstr "Erwarte ein Dictionary mit Elementen, erhielt aber den Typ \"{input_type}\"." +msgstr "Erwartete ein Dictionary mit Elementen, erhielt aber den Typ \"{input_type}\"." #: fields.py:1549 msgid "Value must be valid JSON." @@ -320,15 +322,15 @@ msgstr "Abschicken" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "Aufsteigend" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "Absteigend" #: pagination.py:193 msgid "Invalid page." -msgstr "" +msgstr "Ungültige Seite." #: pagination.py:427 msgid "Invalid cursor" @@ -430,7 +432,7 @@ msgstr "Ungültige Version im URL Pfad." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "Ungültige Version im URL-Pfad. Entspricht keinem Versions-Namensraum." #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/el/LC_MESSAGES/django.po b/rest_framework/locale/el/LC_MESSAGES/django.po index be9bdf717..18eb371c9 100644 --- a/rest_framework/locale/el/LC_MESSAGES/django.po +++ b/rest_framework/locale/el/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Greek (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/el/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/es/LC_MESSAGES/django.po b/rest_framework/locale/es/LC_MESSAGES/django.po index b8a89aeb6..c9b6e9455 100644 --- a/rest_framework/locale/es/LC_MESSAGES/django.po +++ b/rest_framework/locale/es/LC_MESSAGES/django.po @@ -6,6 +6,7 @@ # Ernesto Rico-Schmidt , 2015 # José Padilla , 2015 # Miguel Gonzalez , 2015 +# Miguel Gonzalez , 2016 # Miguel Gonzalez , 2015-2016 # Sergio Infante , 2015 msgid "" @@ -13,8 +14,8 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Miguel Gonzalez \n" "Language-Team: Spanish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -319,11 +320,11 @@ msgstr "Enviar" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "ascendiente" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "descendiente" #: pagination.py:193 msgid "Invalid page." @@ -429,7 +430,7 @@ msgstr "Versión inválida en la ruta de la URL." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "La versión especificada en la ruta de la URL no es válida. No coincide con ninguna del espacio de nombres de versiones." #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/et/LC_MESSAGES/django.po b/rest_framework/locale/et/LC_MESSAGES/django.po index c9701cca7..cc2c2e3f0 100644 --- a/rest_framework/locale/et/LC_MESSAGES/django.po +++ b/rest_framework/locale/et/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Estonian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/et/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/fi/LC_MESSAGES/django.po b/rest_framework/locale/fi/LC_MESSAGES/django.po index bf1dd8c10..0791a3005 100644 --- a/rest_framework/locale/fi/LC_MESSAGES/django.po +++ b/rest_framework/locale/fi/LC_MESSAGES/django.po @@ -4,14 +4,14 @@ # # Translators: # Aarni Koskela, 2015 -# Aarni Koskela, 2015 +# Aarni Koskela, 2015-2016 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Aarni Koskela\n" "Language-Team: Finnish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/fi/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -58,35 +58,35 @@ msgstr "Epäkelpo Token." #: authtoken/apps.py:7 msgid "Auth Token" -msgstr "" +msgstr "Autentikaatiotunniste" #: authtoken/models.py:15 msgid "Key" -msgstr "" +msgstr "Avain" #: authtoken/models.py:18 msgid "User" -msgstr "" +msgstr "Käyttäjä" #: authtoken/models.py:20 msgid "Created" -msgstr "" +msgstr "Luotu" #: authtoken/models.py:29 msgid "Token" -msgstr "" +msgstr "Tunniste" #: authtoken/models.py:30 msgid "Tokens" -msgstr "" +msgstr "Tunnisteet" #: authtoken/serializers.py:8 msgid "Username" -msgstr "" +msgstr "Käyttäjänimi" #: authtoken/serializers.py:9 msgid "Password" -msgstr "" +msgstr "Salasana" #: authtoken/serializers.py:20 msgid "User account is disabled." @@ -316,15 +316,15 @@ msgstr "Lähetä" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "nouseva" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "laskeva" #: pagination.py:193 msgid "Invalid page." -msgstr "" +msgstr "Epäkelpo sivu." #: pagination.py:427 msgid "Invalid cursor" @@ -426,7 +426,7 @@ msgstr "Epäkelpo versio URL-polussa." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "URL-polun versio ei täsmää mihinkään versionimiavaruuteen." #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/fr/LC_MESSAGES/django.po b/rest_framework/locale/fr/LC_MESSAGES/django.po index 284999a8b..25b39e453 100644 --- a/rest_framework/locale/fr/LC_MESSAGES/django.po +++ b/rest_framework/locale/fr/LC_MESSAGES/django.po @@ -12,8 +12,8 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Xavier Ordoquy \n" "Language-Team: French (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -318,11 +318,11 @@ msgstr "Envoyer" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "croissant" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "décroissant" #: pagination.py:193 msgid "Invalid page." @@ -428,7 +428,7 @@ msgstr "Version non valide dans l'URL." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "Version invalide dans l'URL. Ne correspond à aucune version de l'espace de nommage." #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/hu/LC_MESSAGES/django.po b/rest_framework/locale/hu/LC_MESSAGES/django.po index 7f3081fff..9002f8e61 100644 --- a/rest_framework/locale/hu/LC_MESSAGES/django.po +++ b/rest_framework/locale/hu/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Hungarian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/hu/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/it/LC_MESSAGES/django.po b/rest_framework/locale/it/LC_MESSAGES/django.po index 6a48c53a7..a48f8645d 100644 --- a/rest_framework/locale/it/LC_MESSAGES/django.po +++ b/rest_framework/locale/it/LC_MESSAGES/django.po @@ -12,7 +12,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Italian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/it/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/ja/LC_MESSAGES/django.po b/rest_framework/locale/ja/LC_MESSAGES/django.po index d2881dec9..a5e72d9a1 100644 --- a/rest_framework/locale/ja/LC_MESSAGES/django.po +++ b/rest_framework/locale/ja/LC_MESSAGES/django.po @@ -4,13 +4,14 @@ # # Translators: # Hiroaki Nakamura , 2016 +# Kouichi Nishizawa , 2017 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Kouichi Nishizawa \n" "Language-Team: Japanese (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ja/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -315,15 +316,15 @@ msgstr "提出" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "昇順" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "降順" #: pagination.py:193 msgid "Invalid page." -msgstr "" +msgstr "不正なページです。" #: pagination.py:427 msgid "Invalid cursor" @@ -425,7 +426,7 @@ msgstr "URLパス内のバージョンが不正です。" #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "不正なバージョンのURLのパスです。どのバージョンの名前空間にも一致しません。" #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/ko_KR/LC_MESSAGES/django.po b/rest_framework/locale/ko_KR/LC_MESSAGES/django.po index 4ca53b3c3..152bc7b00 100644 --- a/rest_framework/locale/ko_KR/LC_MESSAGES/django.po +++ b/rest_framework/locale/ko_KR/LC_MESSAGES/django.po @@ -3,14 +3,15 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: +# Joon Hwan 김준환 , 2017 # SUN CHOI , 2015 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Joon Hwan 김준환 \n" "Language-Team: Korean (Korea) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ko_KR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -247,7 +248,7 @@ msgstr "Time의 포멧이 잘못되었습니다. 이 형식들 중 한가지를 #: fields.py:1232 msgid "Duration has wrong format. Use one of these formats instead: {format}." -msgstr "" +msgstr "Duration의 포멧이 잘못되었습니다. 이 형식들 중 한가지를 사용하세요: {format}." #: fields.py:1251 fields.py:1300 msgid "\"{input}\" is not a valid choice." @@ -263,11 +264,11 @@ msgstr "아이템 리스트가 예상되었으나 \"{input_type}\"를 받았습 #: fields.py:1302 msgid "This selection may not be empty." -msgstr "" +msgstr "이 선택 항목은 비워 둘 수 없습니다." #: fields.py:1339 msgid "\"{input}\" is not a valid path choice." -msgstr "" +msgstr "\"{input}\"이 유효하지 않은 경로 선택입니다." #: fields.py:1358 msgid "No file was submitted." @@ -299,7 +300,7 @@ msgstr "유효한 이미지 파일을 업로드 하십시오. 업로드 하신 #: fields.py:1449 relations.py:438 serializers.py:525 msgid "This list may not be empty." -msgstr "" +msgstr "이 리스트는 비워 둘 수 없습니다." #: fields.py:1502 msgid "Expected a dictionary of items but got type \"{input_type}\"." @@ -307,7 +308,7 @@ msgstr "아이템 딕셔너리가 예상되었으나 \"{input_type}\" 타입을 #: fields.py:1549 msgid "Value must be valid JSON." -msgstr "" +msgstr "Value 는 유효한 JSON형식이어야 합니다." #: filters.py:36 templates/rest_framework/filters/django_filter.html:5 msgid "Submit" @@ -315,15 +316,15 @@ msgstr "" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "오름차순" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "내림차순" #: pagination.py:193 msgid "Invalid page." -msgstr "" +msgstr "페이지가 유효하지 않습니다." #: pagination.py:427 msgid "Invalid cursor" @@ -381,7 +382,7 @@ msgstr "" #: templates/rest_framework/filters/search.html:2 msgid "Search" -msgstr "" +msgstr "검색" #: templates/rest_framework/horizontal/radio.html:2 #: templates/rest_framework/inline/radio.html:2 @@ -401,19 +402,19 @@ msgstr "이 칸은 반드시 고유해야 합니다." #: validators.py:97 msgid "The fields {field_names} must make a unique set." -msgstr "" +msgstr "{field_names} 필드는 반드시 고유하게 설정해야 합니다." #: validators.py:245 msgid "This field must be unique for the \"{date_field}\" date." -msgstr "" +msgstr "이 칸은 \"{date_field}\"날짜에 대해 고유해야합니다." #: validators.py:260 msgid "This field must be unique for the \"{date_field}\" month." -msgstr "" +msgstr "이 칸은 \"{date_field}\" 월에 대해 고유해야합니다." #: validators.py:273 msgid "This field must be unique for the \"{date_field}\" year." -msgstr "" +msgstr "이 칸은 \"{date_field}\" 년에 대해 고유해야합니다." #: versioning.py:42 msgid "Invalid version in \"Accept\" header." @@ -425,7 +426,7 @@ msgstr "URL path내 버전이 유효하지 않습니다." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "URL 경로에 유효하지 않은 버전이 있습니다. 버전 네임 스페이스와 일치하지 않습니다." #: versioning.py:147 msgid "Invalid version in hostname." @@ -437,4 +438,4 @@ msgstr "쿼리 파라메터내 버전이 유효하지 않습니다." #: views.py:88 msgid "Permission denied." -msgstr "" +msgstr "사용 권한이 거부되었습니다." diff --git a/rest_framework/locale/lv/LC_MESSAGES/django.po b/rest_framework/locale/lv/LC_MESSAGES/django.po new file mode 100644 index 000000000..2bc978866 --- /dev/null +++ b/rest_framework/locale/lv/LC_MESSAGES/django.po @@ -0,0 +1,440 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# peterisb , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Django REST framework\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-07-12 16:13+0100\n" +"PO-Revision-Date: 2017-08-05 12:13+0000\n" +"Last-Translator: peterisb \n" +"Language-Team: Latvian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/lv/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: lv\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\n" + +#: authentication.py:73 +msgid "Invalid basic header. No credentials provided." +msgstr "Nederīgs pieprasījuma sākums. Akreditācijas parametri nav nodrošināti." + +#: authentication.py:76 +msgid "Invalid basic header. Credentials string should not contain spaces." +msgstr "Nederīgs pieprasījuma sākums. Akreditācijas parametriem jābūt bez atstarpēm." + +#: authentication.py:82 +msgid "Invalid basic header. Credentials not correctly base64 encoded." +msgstr "Nederīgs pieprasījuma sākums. Akreditācijas parametri nav korekti base64 kodēti." + +#: authentication.py:99 +msgid "Invalid username/password." +msgstr "Nederīgs lietotājvārds/parole." + +#: authentication.py:102 authentication.py:198 +msgid "User inactive or deleted." +msgstr "Lietotājs neaktīvs vai dzēsts." + +#: authentication.py:176 +msgid "Invalid token header. No credentials provided." +msgstr "Nederīgs pilnvaras sākums. Akreditācijas parametri nav nodrošināti." + +#: authentication.py:179 +msgid "Invalid token header. Token string should not contain spaces." +msgstr "Nederīgs pilnvaras sākums. Pilnvaras parametros nevar būt tukšumi." + +#: authentication.py:185 +msgid "" +"Invalid token header. Token string should not contain invalid characters." +msgstr "Nederīgs pilnvaras sākums. Pilnvaras parametros nevar būt nederīgas zīmes." + +#: authentication.py:195 +msgid "Invalid token." +msgstr "Nederīga pilnavara." + +#: authtoken/apps.py:7 +msgid "Auth Token" +msgstr "Autorizācijas pilnvara" + +#: authtoken/models.py:15 +msgid "Key" +msgstr "Atslēga" + +#: authtoken/models.py:18 +msgid "User" +msgstr "Lietotājs" + +#: authtoken/models.py:20 +msgid "Created" +msgstr "Izveidots" + +#: authtoken/models.py:29 +msgid "Token" +msgstr "Pilnvara" + +#: authtoken/models.py:30 +msgid "Tokens" +msgstr "Pilnvaras" + +#: authtoken/serializers.py:8 +msgid "Username" +msgstr "Lietotājvārds" + +#: authtoken/serializers.py:9 +msgid "Password" +msgstr "Parole" + +#: authtoken/serializers.py:20 +msgid "User account is disabled." +msgstr "Lietotāja konts ir atslēgts." + +#: authtoken/serializers.py:23 +msgid "Unable to log in with provided credentials." +msgstr "Neiespējami pieteikties sistēmā ar nodrošinātajiem akreditācijas datiem." + +#: authtoken/serializers.py:26 +msgid "Must include \"username\" and \"password\"." +msgstr "Jābūt iekļautam \"username\" un \"password\"." + +#: exceptions.py:49 +msgid "A server error occurred." +msgstr "Notikusi servera kļūda." + +#: exceptions.py:84 +msgid "Malformed request." +msgstr "Nenoformēts pieprasījums." + +#: exceptions.py:89 +msgid "Incorrect authentication credentials." +msgstr "Nekorekti autentifikācijas parametri." + +#: exceptions.py:94 +msgid "Authentication credentials were not provided." +msgstr "Netika nodrošināti autorizācijas parametri." + +#: exceptions.py:99 +msgid "You do not have permission to perform this action." +msgstr "Tev nav tiesību veikt šo darbību." + +#: exceptions.py:104 views.py:81 +msgid "Not found." +msgstr "Nav atrasts." + +#: exceptions.py:109 +msgid "Method \"{method}\" not allowed." +msgstr "Metode \"{method}\" nav atļauta." + +#: exceptions.py:120 +msgid "Could not satisfy the request Accept header." +msgstr "Nevarēja apmierināt pieprasījuma Accept header." + +#: exceptions.py:132 +msgid "Unsupported media type \"{media_type}\" in request." +msgstr "Pieprasījumā neatbalstīts datu tips \"{media_type}\" ." + +#: exceptions.py:145 +msgid "Request was throttled." +msgstr "Pieprasījums tika apturēts." + +#: fields.py:269 relations.py:206 relations.py:239 validators.py:98 +#: validators.py:181 +msgid "This field is required." +msgstr "Šis lauks ir obligāts." + +#: fields.py:270 +msgid "This field may not be null." +msgstr "Šis lauks nevar būt null." + +#: fields.py:608 fields.py:639 +msgid "\"{input}\" is not a valid boolean." +msgstr "\"{input}\" ir nederīga loģiskā vērtība." + +#: fields.py:674 +msgid "This field may not be blank." +msgstr "Šis lauks nevar būt tukšs." + +#: fields.py:675 fields.py:1675 +msgid "Ensure this field has no more than {max_length} characters." +msgstr "Pārliecinies, ka laukā nav vairāk par {max_length} zīmēm." + +#: fields.py:676 +msgid "Ensure this field has at least {min_length} characters." +msgstr "Pārliecinies, ka laukā ir vismaz {min_length} zīmes." + +#: fields.py:713 +msgid "Enter a valid email address." +msgstr "Ievadi derīgu e-pasta adresi." + +#: fields.py:724 +msgid "This value does not match the required pattern." +msgstr "Šī vērtība neatbilst prasītajam pierakstam." + +#: fields.py:735 +msgid "" +"Enter a valid \"slug\" consisting of letters, numbers, underscores or " +"hyphens." +msgstr "Ievadi derīgu \"slug\" vērtību, kura sastāv no burtiem, skaitļiem, apakš-svītras vai defises." + +#: fields.py:747 +msgid "Enter a valid URL." +msgstr "Ievadi derīgu URL." + +#: fields.py:760 +msgid "\"{value}\" is not a valid UUID." +msgstr "\"{value}\" ir nedrīgs UUID." + +#: fields.py:796 +msgid "Enter a valid IPv4 or IPv6 address." +msgstr "Ievadi derīgu IPv4 vai IPv6 adresi." + +#: fields.py:821 +msgid "A valid integer is required." +msgstr "Prasīta ir derīga skaitliska vērtība." + +#: fields.py:822 fields.py:857 fields.py:891 +msgid "Ensure this value is less than or equal to {max_value}." +msgstr "Pārliecinies, ka šī vērtība ir mazāka vai vienāda ar {max_value}." + +#: fields.py:823 fields.py:858 fields.py:892 +msgid "Ensure this value is greater than or equal to {min_value}." +msgstr "Pārliecinies, ka šī vērtība ir lielāka vai vienāda ar {min_value}." + +#: fields.py:824 fields.py:859 fields.py:896 +msgid "String value too large." +msgstr "Teksta vērtība pārāk liela." + +#: fields.py:856 fields.py:890 +msgid "A valid number is required." +msgstr "Derīgs skaitlis ir prasīts." + +#: fields.py:893 +msgid "Ensure that there are no more than {max_digits} digits in total." +msgstr "Pārliecinies, ka nav vairāk par {max_digits} zīmēm kopā." + +#: fields.py:894 +msgid "" +"Ensure that there are no more than {max_decimal_places} decimal places." +msgstr "Pārliecinies, ka nav vairāk par {max_decimal_places} decimālajām zīmēm." + +#: fields.py:895 +msgid "" +"Ensure that there are no more than {max_whole_digits} digits before the " +"decimal point." +msgstr "Pārliecinies, ka nav vairāk par {max_whole_digits} zīmēm pirms komata." + +#: fields.py:1025 +msgid "Datetime has wrong format. Use one of these formats instead: {format}." +msgstr "Datuma un laika formāts ir nepareizs. Lieto vienu no norādītajiem formātiem: \"{format}.\"" + +#: fields.py:1026 +msgid "Expected a datetime but got a date." +msgstr "Tika gaidīts datums un laiks, saņemts datums.." + +#: fields.py:1103 +msgid "Date has wrong format. Use one of these formats instead: {format}." +msgstr "Datumam ir nepareizs formāts. Lieto vienu no norādītajiem formātiem: {format}." + +#: fields.py:1104 +msgid "Expected a date but got a datetime." +msgstr "Tika gaidīts datums, saņemts datums un laiks." + +#: fields.py:1170 +msgid "Time has wrong format. Use one of these formats instead: {format}." +msgstr "Laikam ir nepareizs formāts. Lieto vienu no norādītajiem formātiem: {format}." + +#: fields.py:1232 +msgid "Duration has wrong format. Use one of these formats instead: {format}." +msgstr "Ilgumam ir nepreizs formāts. Lieto vienu no norādītajiem formātiem: {format}." + +#: fields.py:1251 fields.py:1300 +msgid "\"{input}\" is not a valid choice." +msgstr "\"{input}\" ir nederīga izvēle." + +#: fields.py:1254 relations.py:71 relations.py:441 +msgid "More than {count} items..." +msgstr "Vairāk par {count} ierakstiem..." + +#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524 +msgid "Expected a list of items but got type \"{input_type}\"." +msgstr "Tika gaidīts saraksts ar ierakstiem, bet tika saņemts \"{input_type}\" tips." + +#: fields.py:1302 +msgid "This selection may not be empty." +msgstr "Šī daļa nevar būt tukša." + +#: fields.py:1339 +msgid "\"{input}\" is not a valid path choice." +msgstr "\"{input}\" ir nederīga ceļa izvēle." + +#: fields.py:1358 +msgid "No file was submitted." +msgstr "Neviens fails netika pievienots." + +#: fields.py:1359 +msgid "" +"The submitted data was not a file. Check the encoding type on the form." +msgstr "Pievienotie dati nebija fails. Pārbaudi kodējuma tipu formā." + +#: fields.py:1360 +msgid "No filename could be determined." +msgstr "Faila nosaukums nevar tikt noteikts." + +#: fields.py:1361 +msgid "The submitted file is empty." +msgstr "Pievienotais fails ir tukšs." + +#: fields.py:1362 +msgid "" +"Ensure this filename has at most {max_length} characters (it has {length})." +msgstr "Pārliecinies, ka faila nosaukumā ir vismaz {max_length} zīmes (tajā ir {length})." + +#: fields.py:1410 +msgid "" +"Upload a valid image. The file you uploaded was either not an image or a " +"corrupted image." +msgstr "Augšupielādē derīgu attēlu. Pievienotā datne nebija attēls vai bojāts attēls." + +#: fields.py:1449 relations.py:438 serializers.py:525 +msgid "This list may not be empty." +msgstr "Šis saraksts nevar būt tukšs." + +#: fields.py:1502 +msgid "Expected a dictionary of items but got type \"{input_type}\"." +msgstr "Tika gaidīta vārdnīca ar ierakstiem, bet tika saņemts \"{input_type}\" tips." + +#: fields.py:1549 +msgid "Value must be valid JSON." +msgstr "Vērtībai ir jābūt derīgam JSON." + +#: filters.py:36 templates/rest_framework/filters/django_filter.html:5 +msgid "Submit" +msgstr "Iesniegt" + +#: filters.py:336 +msgid "ascending" +msgstr "augoši" + +#: filters.py:337 +msgid "descending" +msgstr "dilstoši" + +#: pagination.py:193 +msgid "Invalid page." +msgstr "Nederīga lapa." + +#: pagination.py:427 +msgid "Invalid cursor" +msgstr "Nederīgs kursors" + +#: relations.py:207 +msgid "Invalid pk \"{pk_value}\" - object does not exist." +msgstr "Nederīga pk \"{pk_value}\" - objekts neeksistē." + +#: relations.py:208 +msgid "Incorrect type. Expected pk value, received {data_type}." +msgstr "Nepareizs tips. Tika gaidīta pk vērtība, saņemts {data_type}." + +#: relations.py:240 +msgid "Invalid hyperlink - No URL match." +msgstr "Nederīga hipersaite - Nav URL sakritība." + +#: relations.py:241 +msgid "Invalid hyperlink - Incorrect URL match." +msgstr "Nederīga hipersaite - Nederīga URL sakritība." + +#: relations.py:242 +msgid "Invalid hyperlink - Object does not exist." +msgstr "Nederīga hipersaite - Objekts neeksistē." + +#: relations.py:243 +msgid "Incorrect type. Expected URL string, received {data_type}." +msgstr "Nepareizs tips. Tika gaidīts URL teksts, saņemts {data_type}." + +#: relations.py:401 +msgid "Object with {slug_name}={value} does not exist." +msgstr "Objekts ar {slug_name}={value} neeksistē." + +#: relations.py:402 +msgid "Invalid value." +msgstr "Nedrīga vērtība." + +#: serializers.py:326 +msgid "Invalid data. Expected a dictionary, but got {datatype}." +msgstr "Nederīgi dati. Tika gaidīta vārdnīca, saņemts {datatype}." + +#: templates/rest_framework/admin.html:116 +#: templates/rest_framework/base.html:128 +msgid "Filters" +msgstr "Filtri" + +#: templates/rest_framework/filters/django_filter.html:2 +#: templates/rest_framework/filters/django_filter_crispyforms.html:4 +msgid "Field filters" +msgstr "Lauka filtri" + +#: templates/rest_framework/filters/ordering.html:3 +msgid "Ordering" +msgstr "Kārtošana" + +#: templates/rest_framework/filters/search.html:2 +msgid "Search" +msgstr "Meklēt" + +#: templates/rest_framework/horizontal/radio.html:2 +#: templates/rest_framework/inline/radio.html:2 +#: templates/rest_framework/vertical/radio.html:2 +msgid "None" +msgstr "Nekas" + +#: templates/rest_framework/horizontal/select_multiple.html:2 +#: templates/rest_framework/inline/select_multiple.html:2 +#: templates/rest_framework/vertical/select_multiple.html:2 +msgid "No items to select." +msgstr "Nav ierakstu, ko izvēlēties." + +#: validators.py:43 +msgid "This field must be unique." +msgstr "Šim laukam ir jābūt unikālam." + +#: validators.py:97 +msgid "The fields {field_names} must make a unique set." +msgstr "Laukiem {field_names} jāveido unikālas kombinācijas." + +#: validators.py:245 +msgid "This field must be unique for the \"{date_field}\" date." +msgstr "Šim laukam ir jābūt unikālam priekš \"{date_field}\" datuma." + +#: validators.py:260 +msgid "This field must be unique for the \"{date_field}\" month." +msgstr "Šim laukam ir jābūt unikālam priekš \"{date_field}\" mēneša." + +#: validators.py:273 +msgid "This field must be unique for the \"{date_field}\" year." +msgstr "Šim laukam ir jābūt unikālam priekš \"{date_field}\" gada." + +#: versioning.py:42 +msgid "Invalid version in \"Accept\" header." +msgstr "Nederīga versija \"Accept\" galvenē." + +#: versioning.py:73 +msgid "Invalid version in URL path." +msgstr "Nederīga versija URL ceļā." + +#: versioning.py:115 +msgid "Invalid version in URL path. Does not match any version namespace." +msgstr "Nederīga versija URL ceļā. Nav atbilstības esošo versiju telpā." + +#: versioning.py:147 +msgid "Invalid version in hostname." +msgstr "Nederīga versija servera nosaukumā." + +#: versioning.py:169 +msgid "Invalid version in query parameter." +msgstr "Nederīga versija pieprasījuma parametros." + +#: views.py:88 +msgid "Permission denied." +msgstr "Pieeja liegta." diff --git a/rest_framework/locale/mk/LC_MESSAGES/django.po b/rest_framework/locale/mk/LC_MESSAGES/django.po index d53a30677..0e59663d0 100644 --- a/rest_framework/locale/mk/LC_MESSAGES/django.po +++ b/rest_framework/locale/mk/LC_MESSAGES/django.po @@ -3,14 +3,14 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: -# Filip Dimitrovski , 2015 +# Filip Dimitrovski , 2015-2016 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Filip Dimitrovski \n" "Language-Team: Macedonian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/mk/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -57,7 +57,7 @@ msgstr "Невалиден токен." #: authtoken/apps.py:7 msgid "Auth Token" -msgstr "" +msgstr "Автентикациски токен" #: authtoken/models.py:15 msgid "Key" @@ -65,7 +65,7 @@ msgstr "" #: authtoken/models.py:18 msgid "User" -msgstr "" +msgstr "Корисник" #: authtoken/models.py:20 msgid "Created" @@ -73,19 +73,19 @@ msgstr "" #: authtoken/models.py:29 msgid "Token" -msgstr "" +msgstr "Токен" #: authtoken/models.py:30 msgid "Tokens" -msgstr "" +msgstr "Токени" #: authtoken/serializers.py:8 msgid "Username" -msgstr "" +msgstr "Корисничко име" #: authtoken/serializers.py:9 msgid "Password" -msgstr "" +msgstr "Лозинка" #: authtoken/serializers.py:20 msgid "User account is disabled." @@ -184,11 +184,11 @@ msgstr "Внесете валиден URL." #: fields.py:760 msgid "\"{value}\" is not a valid UUID." -msgstr "" +msgstr "\"{value}\" не е валиден UUID." #: fields.py:796 msgid "Enter a valid IPv4 or IPv6 address." -msgstr "" +msgstr "Внеси валидна IPv4 или IPv6 адреса." #: fields.py:821 msgid "A valid integer is required." @@ -255,11 +255,11 @@ msgstr "„{input}“ не е валиден избор." #: fields.py:1254 relations.py:71 relations.py:441 msgid "More than {count} items..." -msgstr "" +msgstr "Повеќе од {count} ставки..." #: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524 msgid "Expected a list of items but got type \"{input_type}\"." -msgstr "Очекувана беше листа, а внесено беше „{input_type}“." +msgstr "Очекувана беше листа од ставки, а внесено беше „{input_type}“." #: fields.py:1302 msgid "This selection may not be empty." @@ -299,35 +299,35 @@ msgstr "Качете (upload-ирајте) валидна слика. Фајло #: fields.py:1449 relations.py:438 serializers.py:525 msgid "This list may not be empty." -msgstr "" +msgstr "Оваа листа не смее да биде празна." #: fields.py:1502 msgid "Expected a dictionary of items but got type \"{input_type}\"." -msgstr "" +msgstr "Очекуван беше dictionary од ставки, a внесен беше тип \"{input_type}\"." #: fields.py:1549 msgid "Value must be valid JSON." -msgstr "" +msgstr "Вредноста мора да биде валиден JSON." #: filters.py:36 templates/rest_framework/filters/django_filter.html:5 msgid "Submit" -msgstr "" +msgstr "Испрати" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "растечки" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "опаѓачки" #: pagination.py:193 msgid "Invalid page." -msgstr "" +msgstr "Невалидна вредност за страна." #: pagination.py:427 msgid "Invalid cursor" -msgstr "" +msgstr "Невалиден покажувач (cursor)" #: relations.py:207 msgid "Invalid pk \"{pk_value}\" - object does not exist." @@ -368,32 +368,32 @@ msgstr "Невалидни податоци. Очекуван беше dictionar #: templates/rest_framework/admin.html:116 #: templates/rest_framework/base.html:128 msgid "Filters" -msgstr "" +msgstr "Филтри" #: templates/rest_framework/filters/django_filter.html:2 #: templates/rest_framework/filters/django_filter_crispyforms.html:4 msgid "Field filters" -msgstr "" +msgstr "Филтри на полиња" #: templates/rest_framework/filters/ordering.html:3 msgid "Ordering" -msgstr "" +msgstr "Подредување" #: templates/rest_framework/filters/search.html:2 msgid "Search" -msgstr "" +msgstr "Пребарај" #: templates/rest_framework/horizontal/radio.html:2 #: templates/rest_framework/inline/radio.html:2 #: templates/rest_framework/vertical/radio.html:2 msgid "None" -msgstr "" +msgstr "Ништо" #: templates/rest_framework/horizontal/select_multiple.html:2 #: templates/rest_framework/inline/select_multiple.html:2 #: templates/rest_framework/vertical/select_multiple.html:2 msgid "No items to select." -msgstr "" +msgstr "Нема ставки за избирање." #: validators.py:43 msgid "This field must be unique." @@ -425,7 +425,7 @@ msgstr "Невалидна верзија во URL патеката." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "Верзијата во URL патеката не е валидна. Не се согласува со ниеден version namespace (именски простор за верзии)." #: versioning.py:147 msgid "Invalid version in hostname." @@ -437,4 +437,4 @@ msgstr "Невалидна верзија во query параметарот." #: views.py:88 msgid "Permission denied." -msgstr "" +msgstr "Барањето не е дозволено." diff --git a/rest_framework/locale/nb/LC_MESSAGES/django.po b/rest_framework/locale/nb/LC_MESSAGES/django.po index 634a24642..f9ecada63 100644 --- a/rest_framework/locale/nb/LC_MESSAGES/django.po +++ b/rest_framework/locale/nb/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Norwegian Bokmål (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/nb/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/nl/LC_MESSAGES/django.po b/rest_framework/locale/nl/LC_MESSAGES/django.po index 6b9dd127b..370f3aa41 100644 --- a/rest_framework/locale/nl/LC_MESSAGES/django.po +++ b/rest_framework/locale/nl/LC_MESSAGES/django.po @@ -4,16 +4,17 @@ # # Translators: # Hans van Luttikhuizen , 2016 -# mikedingjan , 2015 -# mikedingjan , 2015 +# Mike Dingjan , 2015 +# Mike Dingjan , 2017 +# Mike Dingjan , 2015 # Hans van Luttikhuizen , 2016 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Mike Dingjan \n" "Language-Team: Dutch (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/nl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -318,11 +319,11 @@ msgstr "Verzenden" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "oplopend" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "aflopend" #: pagination.py:193 msgid "Invalid page." @@ -428,7 +429,7 @@ msgstr "Ongeldige versie in URL-pad." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "Ongeldige versie in het URL pad, komt niet overeen met een geldige versie namespace" #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/pl/LC_MESSAGES/django.po b/rest_framework/locale/pl/LC_MESSAGES/django.po index b8592e9b7..611426556 100644 --- a/rest_framework/locale/pl/LC_MESSAGES/django.po +++ b/rest_framework/locale/pl/LC_MESSAGES/django.po @@ -5,20 +5,21 @@ # Translators: # Janusz Harkot , 2015 # Piotr Jakimiak , 2015 +# m_aciek , 2016 # m_aciek , 2015-2016 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: m_aciek \n" "Language-Team: Polish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/pl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: pl\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" #: authentication.py:73 msgid "Invalid basic header. No credentials provided." @@ -317,11 +318,11 @@ msgstr "Wyślij" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "rosnąco" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "malejąco" #: pagination.py:193 msgid "Invalid page." @@ -427,7 +428,7 @@ msgstr "Błędna wersja w ścieżce URL." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "Niepoprawna wersja w ścieżce URL. Nie pasuje do przestrzeni nazw żadnej wersji." #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/pt_BR/LC_MESSAGES/django.po b/rest_framework/locale/pt_BR/LC_MESSAGES/django.po index 2c90f14ca..3a57b6770 100644 --- a/rest_framework/locale/pt_BR/LC_MESSAGES/django.po +++ b/rest_framework/locale/pt_BR/LC_MESSAGES/django.po @@ -12,7 +12,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/pt_BR/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/ro/LC_MESSAGES/django.po b/rest_framework/locale/ro/LC_MESSAGES/django.po index bb3b5e3c0..d144d847e 100644 --- a/rest_framework/locale/ro/LC_MESSAGES/django.po +++ b/rest_framework/locale/ro/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Romanian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ro/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/ru/LC_MESSAGES/django.po b/rest_framework/locale/ru/LC_MESSAGES/django.po index b73270906..7e09b227e 100644 --- a/rest_framework/locale/ru/LC_MESSAGES/django.po +++ b/rest_framework/locale/ru/LC_MESSAGES/django.po @@ -3,6 +3,7 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: +# Grigory Mishchenko , 2017 # Kirill Tarasenko, 2015 # koodjo , 2015 # Mike TUMS , 2015 @@ -12,8 +13,8 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Grigory Mishchenko \n" "Language-Team: Russian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -161,11 +162,11 @@ msgstr "Это поле не может быть пустым." #: fields.py:675 fields.py:1675 msgid "Ensure this field has no more than {max_length} characters." -msgstr "Убедитесь что в этом поле не больше {max_length} символов." +msgstr "Убедитесь, что в этом поле не больше {max_length} символов." #: fields.py:676 msgid "Ensure this field has at least {min_length} characters." -msgstr "Убедитесь что в этом поле как минимум {min_length} символов." +msgstr "Убедитесь, что в этом поле как минимум {min_length} символов." #: fields.py:713 msgid "Enter a valid email address." @@ -199,11 +200,11 @@ msgstr "Требуется целочисленное значение." #: fields.py:822 fields.py:857 fields.py:891 msgid "Ensure this value is less than or equal to {max_value}." -msgstr "Убедитесь что значение меньше или равно {max_value}." +msgstr "Убедитесь, что значение меньше или равно {max_value}." #: fields.py:823 fields.py:858 fields.py:892 msgid "Ensure this value is greater than or equal to {min_value}." -msgstr "Убедитесь что значение больше или равно {min_value}." +msgstr "Убедитесь, что значение больше или равно {min_value}." #: fields.py:824 fields.py:859 fields.py:896 msgid "String value too large." @@ -215,18 +216,18 @@ msgstr "Требуется численное значение." #: fields.py:893 msgid "Ensure that there are no more than {max_digits} digits in total." -msgstr "Убедитесь что в числе не больше {max_digits} знаков." +msgstr "Убедитесь, что в числе не больше {max_digits} знаков." #: fields.py:894 msgid "" "Ensure that there are no more than {max_decimal_places} decimal places." -msgstr "Убедитесь что в числе не больше {max_decimal_places} знаков в дробной части." +msgstr "Убедитесь, что в числе не больше {max_decimal_places} знаков в дробной части." #: fields.py:895 msgid "" "Ensure that there are no more than {max_whole_digits} digits before the " "decimal point." -msgstr "Убедитесь что в цисле не больше {max_whole_digits} знаков в целой части." +msgstr "Убедитесь, что в числе не больше {max_whole_digits} знаков в целой части." #: fields.py:1025 msgid "Datetime has wrong format. Use one of these formats instead: {format}." @@ -279,7 +280,7 @@ msgstr "Не был загружен файл." #: fields.py:1359 msgid "" "The submitted data was not a file. Check the encoding type on the form." -msgstr "Загруженный файл не является корректным файлом. " +msgstr "Загруженный файл не является корректным файлом." #: fields.py:1360 msgid "No filename could be determined." @@ -292,7 +293,7 @@ msgstr "Загруженный файл пуст." #: fields.py:1362 msgid "" "Ensure this filename has at most {max_length} characters (it has {length})." -msgstr "Убедитесь что имя файла меньше {max_length} символов (сейчас {length})." +msgstr "Убедитесь, что имя файла меньше {max_length} символов (сейчас {length})." #: fields.py:1410 msgid "" @@ -338,7 +339,7 @@ msgstr "Недопустимый первичный ключ \"{pk_value}\" - о #: relations.py:208 msgid "Incorrect type. Expected pk value, received {data_type}." -msgstr "Некорректный тип. Ожилалось значение первичного ключа, получен {data_type}." +msgstr "Некорректный тип. Ожидалось значение первичного ключа, получен {data_type}." #: relations.py:240 msgid "Invalid hyperlink - No URL match." diff --git a/rest_framework/locale/sk/LC_MESSAGES/django.po b/rest_framework/locale/sk/LC_MESSAGES/django.po index 1c22d09f0..119430e90 100644 --- a/rest_framework/locale/sk/LC_MESSAGES/django.po +++ b/rest_framework/locale/sk/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Slovak (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/sk/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/sl/LC_MESSAGES/django.po b/rest_framework/locale/sl/LC_MESSAGES/django.po new file mode 100644 index 000000000..9af0fc8fc --- /dev/null +++ b/rest_framework/locale/sl/LC_MESSAGES/django.po @@ -0,0 +1,440 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Gregor Cimerman, 2017 +msgid "" +msgstr "" +"Project-Id-Version: Django REST framework\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-07-12 16:13+0100\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Gregor Cimerman\n" +"Language-Team: Slovenian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#: authentication.py:73 +msgid "Invalid basic header. No credentials provided." +msgstr "Napačno enostavno zagalvje. Ni podanih poverilnic." + +#: authentication.py:76 +msgid "Invalid basic header. Credentials string should not contain spaces." +msgstr "Napačno enostavno zaglavje. Poverilniški niz ne sme vsebovati presledkov." + +#: authentication.py:82 +msgid "Invalid basic header. Credentials not correctly base64 encoded." +msgstr "Napačno enostavno zaglavje. Poverilnice niso pravilno base64 kodirane." + +#: authentication.py:99 +msgid "Invalid username/password." +msgstr "Napačno uporabniško ime ali geslo." + +#: authentication.py:102 authentication.py:198 +msgid "User inactive or deleted." +msgstr "Uporabnik neaktiven ali izbrisan." + +#: authentication.py:176 +msgid "Invalid token header. No credentials provided." +msgstr "Neveljaven žeton v zaglavju. Ni vsebovanih poverilnic." + +#: authentication.py:179 +msgid "Invalid token header. Token string should not contain spaces." +msgstr "Neveljaven žeton v zaglavju. Žeton ne sme vsebovati presledkov." + +#: authentication.py:185 +msgid "" +"Invalid token header. Token string should not contain invalid characters." +msgstr "Neveljaven žeton v zaglavju. Žeton ne sme vsebovati napačnih znakov." + +#: authentication.py:195 +msgid "Invalid token." +msgstr "Neveljaven žeton." + +#: authtoken/apps.py:7 +msgid "Auth Token" +msgstr "Prijavni žeton" + +#: authtoken/models.py:15 +msgid "Key" +msgstr "Ključ" + +#: authtoken/models.py:18 +msgid "User" +msgstr "Uporabnik" + +#: authtoken/models.py:20 +msgid "Created" +msgstr "Ustvarjen" + +#: authtoken/models.py:29 +msgid "Token" +msgstr "Žeton" + +#: authtoken/models.py:30 +msgid "Tokens" +msgstr "Žetoni" + +#: authtoken/serializers.py:8 +msgid "Username" +msgstr "Uporabniško ime" + +#: authtoken/serializers.py:9 +msgid "Password" +msgstr "Geslo" + +#: authtoken/serializers.py:20 +msgid "User account is disabled." +msgstr "Uporabniški račun je onemogočen." + +#: authtoken/serializers.py:23 +msgid "Unable to log in with provided credentials." +msgstr "Neuspešna prijava s podanimi poverilnicami." + +#: authtoken/serializers.py:26 +msgid "Must include \"username\" and \"password\"." +msgstr "Mora vsebovati \"uporabniško ime\" in \"geslo\"." + +#: exceptions.py:49 +msgid "A server error occurred." +msgstr "Napaka na strežniku." + +#: exceptions.py:84 +msgid "Malformed request." +msgstr "Okvarjen zahtevek." + +#: exceptions.py:89 +msgid "Incorrect authentication credentials." +msgstr "Napačni avtentikacijski podatki." + +#: exceptions.py:94 +msgid "Authentication credentials were not provided." +msgstr "Avtentikacijski podatki niso bili podani." + +#: exceptions.py:99 +msgid "You do not have permission to perform this action." +msgstr "Nimate dovoljenj za izvedbo te akcije." + +#: exceptions.py:104 views.py:81 +msgid "Not found." +msgstr "Ni najdeno" + +#: exceptions.py:109 +msgid "Method \"{method}\" not allowed." +msgstr "Metoda \"{method}\" ni dovoljena" + +#: exceptions.py:120 +msgid "Could not satisfy the request Accept header." +msgstr "Ni bilo mogoče zagotoviti zaglavja Accept zahtevka." + +#: exceptions.py:132 +msgid "Unsupported media type \"{media_type}\" in request." +msgstr "Nepodprt medijski tip \"{media_type}\" v zahtevku." + +#: exceptions.py:145 +msgid "Request was throttled." +msgstr "Zahtevek je bil pridržan." + +#: fields.py:269 relations.py:206 relations.py:239 validators.py:98 +#: validators.py:181 +msgid "This field is required." +msgstr "To polje je obvezno." + +#: fields.py:270 +msgid "This field may not be null." +msgstr "To polje ne sme biti null." + +#: fields.py:608 fields.py:639 +msgid "\"{input}\" is not a valid boolean." +msgstr "\"{input}\" ni veljaven boolean." + +#: fields.py:674 +msgid "This field may not be blank." +msgstr "To polje ne sme biti prazno." + +#: fields.py:675 fields.py:1675 +msgid "Ensure this field has no more than {max_length} characters." +msgstr "To polje ne sme biti daljše od {max_length} znakov." + +#: fields.py:676 +msgid "Ensure this field has at least {min_length} characters." +msgstr "To polje mora vsebovati vsaj {min_length} znakov." + +#: fields.py:713 +msgid "Enter a valid email address." +msgstr "Vnesite veljaven elektronski naslov." + +#: fields.py:724 +msgid "This value does not match the required pattern." +msgstr "Ta vrednost ne ustreza zahtevanemu vzorcu." + +#: fields.py:735 +msgid "" +"Enter a valid \"slug\" consisting of letters, numbers, underscores or " +"hyphens." +msgstr "Vnesite veljaven \"slug\", ki vsebuje črke, številke, podčrtaje ali vezaje." + +#: fields.py:747 +msgid "Enter a valid URL." +msgstr "Vnesite veljaven URL." + +#: fields.py:760 +msgid "\"{value}\" is not a valid UUID." +msgstr "\"{value}\" ni veljaven UUID" + +#: fields.py:796 +msgid "Enter a valid IPv4 or IPv6 address." +msgstr "Vnesite veljaven IPv4 ali IPv6 naslov." + +#: fields.py:821 +msgid "A valid integer is required." +msgstr "Zahtevano je veljavno celo število." + +#: fields.py:822 fields.py:857 fields.py:891 +msgid "Ensure this value is less than or equal to {max_value}." +msgstr "Vrednost mora biti manjša ali enaka {max_value}." + +#: fields.py:823 fields.py:858 fields.py:892 +msgid "Ensure this value is greater than or equal to {min_value}." +msgstr "Vrednost mora biti večija ali enaka {min_value}." + +#: fields.py:824 fields.py:859 fields.py:896 +msgid "String value too large." +msgstr "Niz je prevelik." + +#: fields.py:856 fields.py:890 +msgid "A valid number is required." +msgstr "Zahtevano je veljavno število." + +#: fields.py:893 +msgid "Ensure that there are no more than {max_digits} digits in total." +msgstr "Vnesete lahko največ {max_digits} števk." + +#: fields.py:894 +msgid "" +"Ensure that there are no more than {max_decimal_places} decimal places." +msgstr "Vnesete lahko največ {max_decimal_places} decimalnih mest." + +#: fields.py:895 +msgid "" +"Ensure that there are no more than {max_whole_digits} digits before the " +"decimal point." +msgstr "Vnesete lahko največ {max_whole_digits} števk pred decimalno piko." + +#: fields.py:1025 +msgid "Datetime has wrong format. Use one of these formats instead: {format}." +msgstr "Datim in čas v napačnem formatu. Uporabite eno izmed naslednjih formatov: {format}." + +#: fields.py:1026 +msgid "Expected a datetime but got a date." +msgstr "Pričakovan datum in čas, prejet le datum." + +#: fields.py:1103 +msgid "Date has wrong format. Use one of these formats instead: {format}." +msgstr "Datum je v napačnem formatu. Uporabnite enega izmed naslednjih: {format}." + +#: fields.py:1104 +msgid "Expected a date but got a datetime." +msgstr "Pričakovan datum vendar prejet datum in čas." + +#: fields.py:1170 +msgid "Time has wrong format. Use one of these formats instead: {format}." +msgstr "Čas je v napačnem formatu. Uporabite enega izmed naslednjih: {format}." + +#: fields.py:1232 +msgid "Duration has wrong format. Use one of these formats instead: {format}." +msgstr "Trajanje je v napačnem formatu. Uporabite enega izmed naslednjih: {format}." + +#: fields.py:1251 fields.py:1300 +msgid "\"{input}\" is not a valid choice." +msgstr "\"{input}\" ni veljavna izbira." + +#: fields.py:1254 relations.py:71 relations.py:441 +msgid "More than {count} items..." +msgstr "Več kot {count} elementov..." + +#: fields.py:1301 fields.py:1448 relations.py:437 serializers.py:524 +msgid "Expected a list of items but got type \"{input_type}\"." +msgstr "Pričakovan seznam elementov vendar prejet tip \"{input_type}\"." + +#: fields.py:1302 +msgid "This selection may not be empty." +msgstr "Ta izbria ne sme ostati prazna." + +#: fields.py:1339 +msgid "\"{input}\" is not a valid path choice." +msgstr "\"{input}\" ni veljavna izbira poti." + +#: fields.py:1358 +msgid "No file was submitted." +msgstr "Datoteka ni bila oddana." + +#: fields.py:1359 +msgid "" +"The submitted data was not a file. Check the encoding type on the form." +msgstr "Oddani podatki niso datoteka. Preverite vrsto kodiranja na formi." + +#: fields.py:1360 +msgid "No filename could be determined." +msgstr "Imena datoteke ni bilo mogoče določiti." + +#: fields.py:1361 +msgid "The submitted file is empty." +msgstr "Oddana datoteka je prazna." + +#: fields.py:1362 +msgid "" +"Ensure this filename has at most {max_length} characters (it has {length})." +msgstr "Ime datoteke lahko vsebuje največ {max_length} znakov (ta jih ima {length})." + +#: fields.py:1410 +msgid "" +"Upload a valid image. The file you uploaded was either not an image or a " +"corrupted image." +msgstr "Naložite veljavno sliko. Naložena datoteka ni bila slika ali pa je okvarjena." + +#: fields.py:1449 relations.py:438 serializers.py:525 +msgid "This list may not be empty." +msgstr "Seznam ne sme biti prazen." + +#: fields.py:1502 +msgid "Expected a dictionary of items but got type \"{input_type}\"." +msgstr "Pričakovan je slovar elementov, prejet element je tipa \"{input_type}\"." + +#: fields.py:1549 +msgid "Value must be valid JSON." +msgstr "Vrednost mora biti veljaven JSON." + +#: filters.py:36 templates/rest_framework/filters/django_filter.html:5 +msgid "Submit" +msgstr "Potrdi" + +#: filters.py:336 +msgid "ascending" +msgstr "naraščujoče" + +#: filters.py:337 +msgid "descending" +msgstr "padajoče" + +#: pagination.py:193 +msgid "Invalid page." +msgstr "Neveljavna stran." + +#: pagination.py:427 +msgid "Invalid cursor" +msgstr "Neveljaven kazalec" + +#: relations.py:207 +msgid "Invalid pk \"{pk_value}\" - object does not exist." +msgstr "Neveljaven pk \"{pk_value}\" - objekt ne obstaja." + +#: relations.py:208 +msgid "Incorrect type. Expected pk value, received {data_type}." +msgstr "Neveljaven tip. Pričakovana vrednost pk, prejet {data_type}." + +#: relations.py:240 +msgid "Invalid hyperlink - No URL match." +msgstr "Neveljavna povezava - Ni URL." + +#: relations.py:241 +msgid "Invalid hyperlink - Incorrect URL match." +msgstr "Ni veljavna povezava - Napačen URL." + +#: relations.py:242 +msgid "Invalid hyperlink - Object does not exist." +msgstr "Ni veljavna povezava - Objekt ne obstaja." + +#: relations.py:243 +msgid "Incorrect type. Expected URL string, received {data_type}." +msgstr "Napačen tip. Pričakovan URL niz, prejet {data_type}." + +#: relations.py:401 +msgid "Object with {slug_name}={value} does not exist." +msgstr "Objekt z {slug_name}={value} ne obstaja." + +#: relations.py:402 +msgid "Invalid value." +msgstr "Neveljavna vrednost." + +#: serializers.py:326 +msgid "Invalid data. Expected a dictionary, but got {datatype}." +msgstr "Napačni podatki. Pričakovan slovar, prejet {datatype}." + +#: templates/rest_framework/admin.html:116 +#: templates/rest_framework/base.html:128 +msgid "Filters" +msgstr "Filtri" + +#: templates/rest_framework/filters/django_filter.html:2 +#: templates/rest_framework/filters/django_filter_crispyforms.html:4 +msgid "Field filters" +msgstr "Filter polj" + +#: templates/rest_framework/filters/ordering.html:3 +msgid "Ordering" +msgstr "Razvrščanje" + +#: templates/rest_framework/filters/search.html:2 +msgid "Search" +msgstr "Iskanje" + +#: templates/rest_framework/horizontal/radio.html:2 +#: templates/rest_framework/inline/radio.html:2 +#: templates/rest_framework/vertical/radio.html:2 +msgid "None" +msgstr "None" + +#: templates/rest_framework/horizontal/select_multiple.html:2 +#: templates/rest_framework/inline/select_multiple.html:2 +#: templates/rest_framework/vertical/select_multiple.html:2 +msgid "No items to select." +msgstr "Ni elementov za izbiro." + +#: validators.py:43 +msgid "This field must be unique." +msgstr "To polje mora biti unikatno." + +#: validators.py:97 +msgid "The fields {field_names} must make a unique set." +msgstr "Polja {field_names} morajo skupaj sestavljati unikaten niz." + +#: validators.py:245 +msgid "This field must be unique for the \"{date_field}\" date." +msgstr "Polje mora biti unikatno za \"{date_field}\" dan." + +#: validators.py:260 +msgid "This field must be unique for the \"{date_field}\" month." +msgstr "Polje mora biti unikatno za \"{date_field} mesec.\"" + +#: validators.py:273 +msgid "This field must be unique for the \"{date_field}\" year." +msgstr "Polje mora biti unikatno za \"{date_field}\" leto." + +#: versioning.py:42 +msgid "Invalid version in \"Accept\" header." +msgstr "Neveljavna verzija v \"Accept\" zaglavju." + +#: versioning.py:73 +msgid "Invalid version in URL path." +msgstr "Neveljavna različca v poti URL." + +#: versioning.py:115 +msgid "Invalid version in URL path. Does not match any version namespace." +msgstr "Neveljavna različica v poti URL. Se ne ujema z nobeno različico imenskega prostora." + +#: versioning.py:147 +msgid "Invalid version in hostname." +msgstr "Neveljavna različica v imenu gostitelja." + +#: versioning.py:169 +msgid "Invalid version in query parameter." +msgstr "Neveljavna verzija v poizvedbenem parametru." + +#: views.py:88 +msgid "Permission denied." +msgstr "Dovoljenje zavrnjeno." diff --git a/rest_framework/locale/sv/LC_MESSAGES/django.po b/rest_framework/locale/sv/LC_MESSAGES/django.po index 82dde0d87..00acf5644 100644 --- a/rest_framework/locale/sv/LC_MESSAGES/django.po +++ b/rest_framework/locale/sv/LC_MESSAGES/django.po @@ -10,8 +10,8 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Joakim Soderlund\n" "Language-Team: Swedish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/sv/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -316,11 +316,11 @@ msgstr "Skicka" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "stigande" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "fallande" #: pagination.py:193 msgid "Invalid page." @@ -426,7 +426,7 @@ msgstr "Ogiltig version i URL-resursen." #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "Ogiltig version i URL-resursen. Matchar inget versions-namespace." #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/tr/LC_MESSAGES/django.po b/rest_framework/locale/tr/LC_MESSAGES/django.po index 17e6e4a73..d327ab9e2 100644 --- a/rest_framework/locale/tr/LC_MESSAGES/django.po +++ b/rest_framework/locale/tr/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ # Dogukan Tufekci , 2015 # Emrah BİLBAY , 2015 # Ertaç Paprat , 2015 -# Yusuf (Josè) Luis , 2016 +# José Luis , 2016 # Mesut Can Gürle , 2015 # Murat Çorlu , 2015 # Recep KIRMIZI , 2015 @@ -16,7 +16,7 @@ msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Turkish (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/tr/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/tr_TR/LC_MESSAGES/django.po b/rest_framework/locale/tr_TR/LC_MESSAGES/django.po index 171826a63..94856c70f 100644 --- a/rest_framework/locale/tr_TR/LC_MESSAGES/django.po +++ b/rest_framework/locale/tr_TR/LC_MESSAGES/django.po @@ -3,13 +3,13 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: -# Yusuf (Josè) Luis , 2015-2016 +# José Luis , 2015-2016 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" "Last-Translator: Thomas Christie \n" "Language-Team: Turkish (Turkey) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/tr_TR/)\n" "MIME-Version: 1.0\n" diff --git a/rest_framework/locale/uk/LC_MESSAGES/django.po b/rest_framework/locale/uk/LC_MESSAGES/django.po index 51909058f..2bd4369f8 100644 --- a/rest_framework/locale/uk/LC_MESSAGES/django.po +++ b/rest_framework/locale/uk/LC_MESSAGES/django.po @@ -3,16 +3,17 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: -# Denis Podlesniy , 2016 +# Денис Подлесный , 2016 # Illarion , 2016 # Kirill Tarasenko, 2016 +# Victor Mireyev , 2017 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Victor Mireyev \n" "Language-Team: Ukrainian (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/uk/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -317,11 +318,11 @@ msgstr "Відправити" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "в порядку зростання" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "у порядку зменшення" #: pagination.py:193 msgid "Invalid page." diff --git a/rest_framework/locale/zh_CN/LC_MESSAGES/django.po b/rest_framework/locale/zh_CN/LC_MESSAGES/django.po index c21604b42..345bcfac8 100644 --- a/rest_framework/locale/zh_CN/LC_MESSAGES/django.po +++ b/rest_framework/locale/zh_CN/LC_MESSAGES/django.po @@ -4,15 +4,15 @@ # # Translators: # hunter007 , 2015 -# Lele Long , 2015 +# Lele Long , 2015,2017 # Ming Chen , 2015-2016 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: Lele Long \n" "Language-Team: Chinese (China) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/zh_CN/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -63,7 +63,7 @@ msgstr "认证令牌" #: authtoken/models.py:15 msgid "Key" -msgstr "" +msgstr "键" #: authtoken/models.py:18 msgid "User" @@ -71,7 +71,7 @@ msgstr "用户" #: authtoken/models.py:20 msgid "Created" -msgstr "" +msgstr "已创建" #: authtoken/models.py:29 msgid "Token" @@ -317,15 +317,15 @@ msgstr "保存" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "升序" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "降序" #: pagination.py:193 msgid "Invalid page." -msgstr "" +msgstr "无效页。" #: pagination.py:427 msgid "Invalid cursor" @@ -427,7 +427,7 @@ msgstr "URL路径包含无效版本。" #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "URL路径中存在无效版本。版本空间中无法匹配上。" #: versioning.py:147 msgid "Invalid version in hostname." diff --git a/rest_framework/locale/zh_Hans/LC_MESSAGES/django.po b/rest_framework/locale/zh_Hans/LC_MESSAGES/django.po index 9f5cd24f1..aa56ccc45 100644 --- a/rest_framework/locale/zh_Hans/LC_MESSAGES/django.po +++ b/rest_framework/locale/zh_Hans/LC_MESSAGES/django.po @@ -6,13 +6,14 @@ # cokky , 2015 # hunter007 , 2015 # nypisces , 2015 +# ppppfly , 2017 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-07-12 16:13+0100\n" -"PO-Revision-Date: 2016-07-12 15:14+0000\n" -"Last-Translator: Thomas Christie \n" +"PO-Revision-Date: 2017-08-03 14:58+0000\n" +"Last-Translator: ppppfly \n" "Language-Team: Chinese Simplified (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/zh-Hans/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -59,35 +60,35 @@ msgstr "认证令牌无效。" #: authtoken/apps.py:7 msgid "Auth Token" -msgstr "" +msgstr "认证令牌" #: authtoken/models.py:15 msgid "Key" -msgstr "" +msgstr "键" #: authtoken/models.py:18 msgid "User" -msgstr "" +msgstr "用户" #: authtoken/models.py:20 msgid "Created" -msgstr "" +msgstr "已创建" #: authtoken/models.py:29 msgid "Token" -msgstr "" +msgstr "令牌" #: authtoken/models.py:30 msgid "Tokens" -msgstr "" +msgstr "令牌" #: authtoken/serializers.py:8 msgid "Username" -msgstr "" +msgstr "用户名" #: authtoken/serializers.py:9 msgid "Password" -msgstr "" +msgstr "密码" #: authtoken/serializers.py:20 msgid "User account is disabled." @@ -317,15 +318,15 @@ msgstr "提交" #: filters.py:336 msgid "ascending" -msgstr "" +msgstr "正排序" #: filters.py:337 msgid "descending" -msgstr "" +msgstr "倒排序" #: pagination.py:193 msgid "Invalid page." -msgstr "" +msgstr "无效页面。" #: pagination.py:427 msgid "Invalid cursor" @@ -427,7 +428,7 @@ msgstr "URL路径包含无效版本。" #: versioning.py:115 msgid "Invalid version in URL path. Does not match any version namespace." -msgstr "" +msgstr "在URL路径中发现无效的版本。无法匹配任何的版本命名空间。" #: versioning.py:147 msgid "Invalid version in hostname." From d875fb3272fbcb71bb153ca421881907bb1d0bfa Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 21 Aug 2017 12:05:25 +0200 Subject: [PATCH 10/88] Update compiled translations. --- .../locale/ar/LC_MESSAGES/django.mo | Bin 5476 -> 5766 bytes .../locale/ca/LC_MESSAGES/django.mo | Bin 9646 -> 9646 bytes .../locale/cs/LC_MESSAGES/django.mo | Bin 9031 -> 9031 bytes .../locale/da/LC_MESSAGES/django.mo | Bin 9881 -> 10401 bytes .../locale/de/LC_MESSAGES/django.mo | Bin 10609 -> 10926 bytes .../locale/el/LC_MESSAGES/django.mo | Bin 13507 -> 13507 bytes .../locale/es/LC_MESSAGES/django.mo | Bin 10779 -> 11064 bytes .../locale/et/LC_MESSAGES/django.mo | Bin 8732 -> 8732 bytes .../locale/fi/LC_MESSAGES/django.mo | Bin 9993 -> 10549 bytes .../locale/fr/LC_MESSAGES/django.mo | Bin 10770 -> 11014 bytes .../locale/hu/LC_MESSAGES/django.mo | Bin 9123 -> 9123 bytes .../locale/it/LC_MESSAGES/django.mo | Bin 10359 -> 10359 bytes .../locale/ja/LC_MESSAGES/django.mo | Bin 11941 -> 12295 bytes .../locale/ko_KR/LC_MESSAGES/django.mo | Bin 10022 -> 11720 bytes .../locale/lv/LC_MESSAGES/django.mo | Bin 0 -> 10841 bytes .../locale/mk/LC_MESSAGES/django.mo | Bin 10623 -> 12660 bytes .../locale/nb/LC_MESSAGES/django.mo | Bin 9803 -> 9803 bytes .../locale/nl/LC_MESSAGES/django.mo | Bin 10373 -> 10608 bytes .../locale/pl/LC_MESSAGES/django.mo | Bin 10801 -> 11121 bytes .../locale/pt_BR/LC_MESSAGES/django.mo | Bin 10238 -> 10238 bytes .../locale/ro/LC_MESSAGES/django.mo | Bin 10895 -> 10895 bytes .../locale/ru/LC_MESSAGES/django.mo | Bin 13430 -> 13441 bytes .../locale/sk/LC_MESSAGES/django.mo | Bin 9411 -> 9411 bytes .../locale/sl/LC_MESSAGES/django.mo | Bin 0 -> 10390 bytes .../locale/sv/LC_MESSAGES/django.mo | Bin 10426 -> 10625 bytes .../locale/tr/LC_MESSAGES/django.mo | Bin 10550 -> 10550 bytes .../locale/tr_TR/LC_MESSAGES/django.mo | Bin 10522 -> 10522 bytes .../locale/uk/LC_MESSAGES/django.mo | Bin 13352 -> 13478 bytes .../locale/zh_CN/LC_MESSAGES/django.mo | Bin 10007 -> 10342 bytes .../locale/zh_Hans/LC_MESSAGES/django.mo | Bin 9796 -> 10362 bytes 30 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 rest_framework/locale/lv/LC_MESSAGES/django.mo create mode 100644 rest_framework/locale/sl/LC_MESSAGES/django.mo diff --git a/rest_framework/locale/ar/LC_MESSAGES/django.mo b/rest_framework/locale/ar/LC_MESSAGES/django.mo index 06471de238d2249bd794f744ebb7c4c710622b4f..bda2ce995f0a4ecdd7f4f3dfe1260c3af1a10a34 100644 GIT binary patch delta 1536 zcmYk+Uu;uV9Ki8k$H1`(+ODFTY#s!Gf$iEN8w}6^2~h-GZ+zE($fT!kgp^VguEWuGU_!qv0)2RLb#n-WUu1Gz0U<5bg z3z)$zcmlWKb?nB#JdsY3f^4C(fg7LWhj^- ze+px?pW;F^bxaQ1QQO;5*LDC`@cVLz$|7!@MHVCHQCBjGd}O@pRn&?6i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$+1^TVs>#^xjpD#wyOgj*^8@p?0Dd3 J`gZBM=Pz{ueBA&5 diff --git a/rest_framework/locale/ca/LC_MESSAGES/django.mo b/rest_framework/locale/ca/LC_MESSAGES/django.mo index 7418c1ed05769800a93e799c05042bf4a73c7c7e..28faf17fffec2592a0bd0b1c29165312edb30459 100644 GIT binary patch delta 26 hcmZ4Iz0P|>peV1ou7QQFfw6+2iIu6v<~Y#+0RU`@2P6Oh delta 26 hcmZ4Iz0P|>peV1Iu7SC(p^<{2sg@-tR@hQL@^TejeQVI@DhSACd8n`2aJRes3dBPB${Bne1Egkn0Uf}Kj+MLXU_Sb z{~1mVyt6s+Lt)mNhGr9sh@MPij^RW$AGFtVjH$pAXkiMM;J5fFKEMUI@S*hYS7I6C zA*{u5T#l#Ek6&UpUd8psB+R^Aw_`@|DZV&^oj8r#v1Yb0&6vQ|_%Zh3eQd*yIqC18 z!+yr+u?qjeLafS5Ppk=beXHkTT+Q>%X*!L3@g4HdF3m8JsJKjazaPd52N^uox zJcwG!9@Lh-fJ*7x-uRaH{ok0$^-9v9OjPrsEo(*HZv+!d={R&s@HAR@9_QmXn1$2G zZkV6&3H$@ucC(Z}lJ&?X(~7!JKdO92@nJmZjgMkI<723;{$xJ+*9tO<(tlWv8aJbg zXc(Jt5>*4|yzx!c3QCI8f42fH#sjDcM$pX&&SHEEHKA!-hQHtnEG;4bJLvQ?ZLRcu zT!t!Xti>JP_+`|@KST?!B2l3s>-v-;>=Z4k=(&*%wnJ#S%#gs6<6aM$O$xGqf+}lK8CkZ)t^_+iNN)!iNAsy z@H#5>k6LaqC(I@~y5U~bgHEH4-DT9o?jc9n6jh{GP=Rcp*^PY|!!G<3Ibm+zS)?f- z{~FigVr)lU-;erT0?Ty%zoN683)85T6mhonMk_-dvj#p$h8e*coI(oNoIw_AQpia) z*HFcF8#Up3s9N|PRV$Uu!jH>Q6KlY7o^N{SWML55J~M{e`IH5HPIaUU^C_z5+OP*KjbAe}7Y8Dch}dSbUtLNAjxB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>~)wgQyh`U_CyG0ld>x zplVvBQliQ95!(oEm3#)+2$9g1DUWK(yILBtli;`}w{R0`#X2EsY(%oknQyX1e7B%d z!V5CFGydfyb$qIRbZT^B)F@D`Kh-i}E1{iG+f8&5V?+kQZYEc&;$p$c9pbdwL&V)} zBLn5Rhfq4yv|CC=FQFY&Qw{z9eC7M@roy|^9;4Gm>>yM~YN`k2P)(;~1EF)Rlc1KB zB6)H~=|AF+b9^86t<{Wpd09H4;%g)Ni9A9@qqc;2l-Nw{BGep0?*kQ7$UC~UE#Q5b z9n19kR!juk-}CCdb@|HzUVFh@ntQ8o!980Pa(^rua(5Ib`kRBHmSDKS2{*Ne8`p6zGmXX8wKvXj{BU#Q<3pY*aom8pdhvKov)ffO{2w^~+7bW& diff --git a/rest_framework/locale/de/LC_MESSAGES/django.mo b/rest_framework/locale/de/LC_MESSAGES/django.mo index 317124886528d1de71f4021441d60acd700235dc..eb0ddf66dd4a54ffac32403317a4b4db1bd2dacc 100644 GIT binary patch delta 2630 zcmYM#TWl0n9LMpqEwrUbxlafgh;?(c=W+l48#WoZ!d%dH4+m+j1OLr1Y@EhB>MgBPW6QUe$E+Y&Ybf<=S=Un zy}LPmYt*1qhSEz+BEtE`9Kq)b_@SIDGG;2ijTTvQL;61$Gtf5kkTTmUmifiygT!EpHxeixh8SV8! zJBFIcKGe+KLQ-lj1?`8y|4(50`CMOt%0vS{TDo>jt3!{Ldpb{lFl zC2$cQMXm9bp#1agK0lR4JeP%&BY<($bSu$S}t^A6gAUN zZ~}fF_ycOD4}x|+(|L?`IkJDv22^Ic@Jh%S2lay4bTS>=QA@QSAH_4Mz3_3GiZ;iO zs2hhe9d%TVOwKIBMYsWVY+k`9@i=zlZEVMS(zF>*;d=ZHpTauQsJ+yWPvH01jdRP5 zX~FdCRGO*WKy^^c&QM0;NZ;lxYG9XfIo=MOG$nV;I#I{=0&3vDqf-1gl5O)3HsDw* zcN(^!2J!~3)%m|gWic1#kPmGh8|%?WrT7EXsrVVSrl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Xiln-6#JgQu-p%*`M$KT;r#y_C8c0E6$8y`R&H2v~V7EgI}PE>TgWMhDV$m^5YYXJFpVN_&lCRC2F!+{|%T(8ZsZ1X`MT6 z#%+uT@VdvCQ>Y8}Q}RVPi`wH0Sco@KdwtKH&*q{!t`W7OqsTp)DXhUaB6Rl9xq^e3 zN}9bG!aiKYZuFA&etZE{E1%*sn8NZ6Vn4RwWo*R9Ov8~O>iV-HhrZcbtoo<*(XGL~Z| z%f!}2jGs<56EC6md>(bdWz+@BSXT%Z8>c=Kb9BiPFLB3k$x>i7)ORRWc$ zmFz{;&>SY>GA7}V_$0324z#G;NRZB9I?CiaYH60x!WHCgY0^ua70E?yQ5||PflzTO z`_;CK4iAal^b+IkY`?}E&}YwbK3W9VQvOcU_Et?VmQrGn z&@$H(T4pb?hsY;*W7}I&fb6RM-?j^LSM%>=&_tvY)S+G3amW^%X9?|lGI5Ad)1#+X z>rO&@tft3m6LDArnqE{rcF);w)tK6D2m7;472QIp;we!3EtrF=Z4DhgKC5jnokn*M zkIh6%?EU0cPweNE@ub+`x{xQ9k?Bv22E38zRc}f{b$w-3^sd)i)Ek_d7@D?Pf-jFx zhsOif_VCn16EWgWl#fhJ#ENsmoV;qw_zoAD)+B=Pha#z-tE|M{_kricyG@%W-MrFs7WS?l&l diff --git a/rest_framework/locale/el/LC_MESSAGES/django.mo b/rest_framework/locale/el/LC_MESSAGES/django.mo index c7fb97b2ca50c64f7f8d5b0a30b4d462f148575b..d275dba3b79ea42efc138a5fc288084865e6a860 100644 GIT binary patch delta 26 hcmX?{c{p=Jj5x2ku7QQFfw6+2iIu6v=1lP@SpavY2fF|O delta 26 hcmX?{c{p=Jj5x2Eu7SC(p^<{2sgJl(qXj!|qTfX=kxpP!L>s zP$3u}*zmwrNQ?>5_)-IkQ36Cv47^~B#t_6rNJtD1CcZRH^!u9~jVC?(Ip^%`ng9Qs zGt)DjUv#DK7mhq>l-<;4s2#ax$M8^$56Xp6W;5|3I(QRj;qN#DM;Dk)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IAE*cagL*&- zCqlcei2n0VS3+y>q4x*a+vWhyos9mEb7Md7{k&l z@&ikvif9nm;#=5&U*SIVtuR}Ow|G9_`6904`cXXTGy4{mqIV*!zjFO0!_*SbV+_kE zY3{Kmtim0r0o{ky_&jO`6Sxb1!G3I}_ilU{(|8tDD{*Gkhj(HMKSlliV%Ga2$78#z-$E- z)55_Z_TXVub46A4x@aj`@2vBx(8Kk4)Q9n_s}hByqfdl z-uWDAK=Y{jvqGNg=fX;4wXFiRWGPgRIJ)Kmv* zT4ojTMq)Fet;r+ZodC9*$Z9FnshSE1%!XoskgCe1(JieL-T>z(hzc4C0=6IuZkrizpayH%`w?;sX76*K=z z+-;}ysVQxZM4C{osc9wu?_c>|*vb~1?B!T_y^&b!T~}qZbKRy_w9=(qEAMK>dEA|$ zeXkv%rh-&cTGg)6hE8 z_U7gSnWEg_vb%jwX|O)m5nSTS?FqeG-~__c&KKdNvnaCN8IEL~=}5rem}*$>oQp&f zyAOh diff --git a/rest_framework/locale/fr/LC_MESSAGES/django.mo b/rest_framework/locale/fr/LC_MESSAGES/django.mo index 2bc60c63a1e7c38332b1c06124ebff5b552c2e06..e3ba4a2c5065d049f697094a8cece8e499b8db56 100644 GIT binary patch delta 2367 zcmYM!e@s&np=)PdVkJ2y%pU|>=_uoBnZ|ASIo4zLbYnWP2{+(*ti>O&4QI|UrUtuE zzn{Y>-o$0Npum_pxCJ%9J*a-yH)G6M0zL2wR^wmDpDCFcjC4I}##>M?O5jF(2kY<_ zHsSn7j9H6^kS=oub=`R^!5>j8If-j<@hslM`%NoB1@1#V;5BT;tGF4nW(N6L0 z8tjV6!zXYKk_M(Rv<w`gy&Z$5GEeiyF{XjNqSZn6H-RA3CydAGKz*BeyBDiAb+v z1b)%Z?x1QoT5N9cU)6wns4Ci&7C#Ek&LQGwsoSWfRArNjvWE|W|B>H{E2t{XRIO{A zt?)NuyLu_@0sbdwS{O5BzbKb?hq2B_Qy5#QwLD18rgl@c=$)g-@(PRVhz?LybZW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diff --git a/rest_framework/locale/hu/LC_MESSAGES/django.mo b/rest_framework/locale/hu/LC_MESSAGES/django.mo index cb27fb740a8f8efca1fd9c8264bb56df60d5b078..8b884fbed0e46c3ff25408f56c75c10a2fc7ffce 100644 GIT binary patch delta 26 icmZ4NzSw=kVj*60T>}eU17ih46Dw1T%^QS13jhFerwB&? delta 21 dcmZ4NzSw=kVxh^^LYyq7R)!{30su7QQFfw6+2iIu6v<_s}@Apm?$2bTZ< delta 26 hcmew!@I7Edv>30Mu7SC(p^<{2sg=2aW&$ diff --git a/rest_framework/locale/ja/LC_MESSAGES/django.mo b/rest_framework/locale/ja/LC_MESSAGES/django.mo index 1f934cc378a47eb5d4f15aec1e1bde9e58f6acf2..9ce42cfb36dd3d3b65145832e854667adfe857d3 100644 GIT binary patch delta 2580 zcmZA2drVe!9LMn=pxi|8ii)?Bnt2031rQ1b>H;SrwF=W#xiX068uR5XS& z(L$}I>*CDSKQI+*HfwWh>OWmJx3;n!Z~T*8)*m@HdweH0;JC{1r=$iJD$AWmHV#ZW+O)cnOO!zMnB`a1qYN6F3jQ!*WbdGo}#Nqkcbz z6?g;3V^)7-2H^r!2P;waA=jueN66@f=P@7uME=aAbg!ocs1YwfHB^st@B>_kH*paT z&oCwjHzHN04RzlMoP^(_X7UkE!7&49hxW}fGP$@G^@0Pq3@>02#trmdxDc}_ukg!3 z)JS%rM)n>urKZO(Kk|Pc!SEBPFG9^k2^TG06-M>K2$^T_5N6_ewD1NF#^10H##3Nb zOcGAVLC7{RrM~6Jt)>d~o(9x5dJ~7?KEM1vYQP^2X8pC+KT@F)j2`0MScodGLT#on z7GN7{jlcHG4^aci8|vLxffnUPR0j{DJ0sYa@*`A-;_2N~Ovz;a^T^~=u?`zhBfWwn z@T%`E)JPxtbTi+&$DD$kP00lUd>$ zK~3Rl)D7KOiN7HG#^f;_)mY+t%J(sDq`sPI)2a9Zt1xLa`vo`RT0DmvFo6w_kI@=G za}0M=aSaz^*;uawZ8)FudDKY$@||LNFS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DGfjcp4=kl#e3y3A;t6 zi;9+Vzu`gLO!+cuWlAc{#&Hav#P5)?S|@i>hiVAfPMdM%Q_gR&mio{Ne{0%MXW;;9 z;D@kY_y05*&Fp7v!A$Ok_N)`t!5-w#-sWQgUP2~iS5Wu+FIQj9CD#^4QT=tJH$c?y zW>5n^=E@&o7tgnIWM0AGJ^q7_pc-C4`nKyx6U$-Pk72EI%6S8|buAomwVy;i_&927 zFX15OR{C4F+xaXe)Zic)H8_VFNQCKUbfXthP)2EL!|?hN=)9{rgroO=f2Qk z>?U+emJ(V)9pqHX^D;btJDD6;y8-iEzS;SIbkzokO++2R&Un{Nt58TN>Hf3gwu{id zHxgQ{BI02pLh$CbM~E`be+3aIdI%jHr7gsIVj;nS_x?YmqxM&~qKn8Pv~5b-rW#@+ zkx3}6A-MMTgbE~f*S2~&|DfxPX%O~+s}$PjPNJ0H26?aBVoaqV8C|zj>Lb(U3K`fz zWG9bjeGp8>@}EviE-F}`IXxUsOn)5C4%9W&tec(>ha=lY#>aN;jdYCc8QnWEIvi=5 a7$0jRhFnE*ZP7?5d8VQvJsDd$oAoax!qzMR diff --git a/rest_framework/locale/ko_KR/LC_MESSAGES/django.mo b/rest_framework/locale/ko_KR/LC_MESSAGES/django.mo index 6410f0b1cd6cd733df113762a4664c01ecae63ff..f83b7ed71b63d3d110a39732d083b34041064211 100644 GIT binary patch delta 3028 zcmb8vdvH|M9l-Ik5kh$6K?slbTVLk6|H-gE9fkKf(%+kd?;_F3_aq@uJDONdW%l#1c-O#V?)vy@tfXHericpH9- zOED);sZv~qGJXw~;a;r82;PM+;e+^FY{vPsU1O?^%0pau5!d5&+=F+_QEC;&@IL$* zZpFXj8eBIwd;b`2qdkFD_#Z6Bs(IN7twg!r>e-9(ytCLSOZ`0+Sy6s|_Q4IsW_11xoR!9_63(^Wz=(GRjVUh<9QJ8KO!Hm8!?(SciLYGd_*?%T|9(g}$nw zNU2+~9HrfaGV_N}w)P;(7WR4V554Kc4>v1K@QFWnA=q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L_bSptgUMvaVK_-sT=73w*JL Ta4x>$^bITf#3lRuRj=`1FkPP- delta 1789 zcmY+^Z){Ul7{~GF){PYy49f;(Lns~0v94?#j6oSt*+hXsB+MDzAn8D4T3oU=(fGn9 zj2RMrA>QGpW)Ky8L6(?!eQS&)ifDwm_)b|2Mj}alqshz?6aD^fOQI)z?&qG<+url% zIp^#Cj}GN$LuD6?vX59zoCuhuak`8PrFDVXI!s^$kKh{2VHjQ1@20U1Z(tmM#b#Vy zVYUZTxEDw9G5iKoW_b$*&H89Kf*p7jcihTHG2+ozfQfj}38sS~k)X(F?7_Kr~ zfhmmOQ@9*oMh0tdU<*#5p1Y1KaTc`%bC}l)cP%S^(T}QUQET}os;AS~g4a=N`4`48 z`5<|LC-G^V#8vo5$x3?NM!f-VIy{3~%EoH5?RdPJ`ETWBiiY)g6XW=2slKj;yr8}p zH{-iFsORt`CK%R1oJ1wpT|A0$hItrYN44KZ&GdRQwi_>(ycec5L&GMzt+jm*)sY`C zf%B*l#Fz$o4Eyjr_TX>$1hz9>{rDO_j(6~Fj4_=Pcnx2|XC5lmw73-c zgWPE3=TJ%Y1@f_bTr?AvWG1s^3Dk4@QENYndhTO<4rfrmPx2$)VS}h`b{6$NSGhFf zty25nIH)m2dFlXPjG;#UJ!{vRc#lc z!tvnG9R2st1-0!abT(|znr-^S$IUdx+>4F%UT|a3ac?z6y~DA(KviMt(@5ds N`NG6lVd`we{spIM&$j>o diff --git a/rest_framework/locale/lv/LC_MESSAGES/django.mo b/rest_framework/locale/lv/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..2dc5956f3c07ccea0842db3d6cd6549f1f0e9dc3 GIT binary patch literal 10841 zcmb`MdyHJyUB_=;b+c`g5a=tAa*Kc#zJ5G57-b z$Kdnez3=h7E8r>cS@5giQSjT~dGMk4dfp`X5-8ul0?vTn0-ppQd!Oe$3LXQ6zfXbk zKFIM`K%w^8DDyPH=fK|pkAwdJo&rDgu;*35mqA{6Ujn7y zS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l%+o7r~aKZzT!eZ<`yfpA4f2b zr*RFlDaQmpiwE#FE@KbV8^uc)!{6~q9Ak$*j@R%ptYVbM@fobbdl<&@66$}5#(t)4 z;dva#JnAGfnZkqkQraJIoqm)BeE~niBp%+b)KR>NGQb|za}TcLKKvBNFj%3~Bu=CJ z-^VE$vi1X}QoHdm*5Jz+!S_%qV^q4kdN&T!Pa^M9SFsy6aS**sZx=p-^1Ka{&3psp zIlrLnkq|pmmL~NSjTsu}a0PRDyWDsJTktye;vL+JwVbIVcnl}-6ST0g&OJRFC`f!RE%W~`q|6dq$-ShME1Q(abWt2xXZ>aON<>LHQmy0= zDZ%DeTSyLr^PytpoTcOxJ0VB8f((&mvI)va`SP(e&X*3HO{pLDl<26ZNpE<@^+bNa z&dBM_)DwBjx-h@lK9GOV&{qmB+X-)#p}#J)bganIpBMG&7GE%sT$)>$F;}ek^0b*; zTr}g>(#&+5J?pz<=yv~tzUY5PFBFIL`^6nPCy*NMY7KR_hTF~X&c1MGbBM?tvl7YH z*pju7h+E0Ur9Lw@yEtzp%%Rz(xkPeq+U!p*&PT|p^aXn}@U)@Vg6FiiHe#=DyP9RM zmIn=euOgtU&35~Qxtd|ORF4?;`I=yc9lwsJ!^hfeB1xc_g}isxwn diff --git a/rest_framework/locale/nb/LC_MESSAGES/django.mo b/rest_framework/locale/nb/LC_MESSAGES/django.mo index d3dfe100a7f558c9f067d9a720b6889c1a501b9f..d942abc2cfb380462f026a8dbfa09219dbc7b2dd 100644 GIT binary patch delta 26 hcmX@@bJ}M^v>30su7QQFfw6+2iIu6v<_xjN`~Y;C2nYZG delta 26 hcmX@@bJ}M^v>30Mu7SC(p^<{2sgWxX*L&2QTI3EeB6Us z_z0HcF)YKkFay8EMze(dNM!>j%D7s_aU;Hm>o8@ySvNM}Dm;U$@pIgaGiR99VGru} zQy9W=ydCG=VwR2ds1A0Z&PRO{W+$oWfn!*Wzaf8CGBerJ8q|pEQ7`JpT6_^3@JnpM zxwo2C;7;U}ji9bOgC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;Iqn1=LD@gUxsc7x8?nU2L`%n@~5{i`#J;H{o}v8&)kbyC0XM+8aHtIg=%r#*hm1UU1IF4czU%~*+BD-LxaSfhBw%cwv ze?b21HW%Heh)SOdZW6-?s@;rhF^SsZ@hJPRkzaIQyoPH3hDxFZT!%GF{kVUYF=Y5=qND87S9yjsor@1s(rLo*#@__eslnL*8T+O<#N zW3(^g7bRxD;wswja|E=v*PU}1ryb#DvK2M4VSEseA-ig`IVwtq^Qfiy8nx65*pFeR zxf^%lFkZktIFFCx0Mj4Bw@}IW2X4g%o;HThqn7$h)cuz5^u0KW+WK693WK$u@gXeY zYFtXD$X?V9kD?y%F>>PUE{3s$e~M!{wqrAH#6zg#c?P}H;XY5q83g^~xLN0aii)zh zfXe>wQ7aOv_rI7#txO8ra0)e`kFW#ppq8?!!E7aVpdN6*wX>+DKaI@IF1h|2SjzLQ zNQJ@KJZc~{Tv&bULM_n}~k7$d8ft>%l7nUp#Vr>PR}?HI>cu5EHJWWg?p?tg30KD4bjIS@1tZ C(9Nv? diff --git a/rest_framework/locale/pl/LC_MESSAGES/django.mo b/rest_framework/locale/pl/LC_MESSAGES/django.mo index 8af27437f01d85967413cde8c9ce0b58231f0f36..99840f55c0c90c1b3946d92ecedde7aaf2086cd4 100644 GIT binary patch delta 2495 zcmYM#TWnNC9LMpYKyPT37D@qufkLIi;%;eaDcx;pD~Qx`D@Cs5xIHaf+TGeMRG?vf zK_DcGYVB(XBiKdDvF~KW|CTM~oG4URa#0T;6gbiN4zq3a>VfHgKXE`(T|IcjS zX#2fA^-bZVvxd?|eSq3B(U_AsoXrR2Qm!%c@ny950WQKHaW3ZP8B>DgsQ=%Hv#|s7 z@dyU+SzL;5Vh(`V-p@SDZ`RQW;x^O^PT)Fx8^btZYUYLYIE#L( z-;beo@-%8^=aG<_QNMrJe?F7#Ph>odio|L@l)5%d>4ixe58`uJjF-{kbu7Z$I0>`p zkQI}I4`U&63{0c%dgQC74fURG)G<1WGw_(-zku5CD@EjAxxUG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As#L!{u=oy@5awj^*Pigx`p>)*}_b0drDDPvN}zWT?_cor+=}R;;7A6o*j*J%G#bP2^{vanY%nOHoh=ZlYf7a5o3R zda(t!;TC)Yd+-Ks!gWkro9`$-fat0MhXoy%%EoQ3D)4hNcgRibyRy4+i)-He1C{~VHQV#{brr0V>O6G#ips3kg#8u3}L{UWM^ztD&I1fHX8MX1fU82Khy z4{C)5krQmg$RgUL*M1nw=--Y|$ieqfo9QgZ@hTElt7jVOFo6nH66xFah36^waSCI25cTEy5*0%q@z9J$kkzvZWNem3 zE&UnPz|W)3x8g7l`pMDs0e?KD0B$7nLN{r+8_4QiYp%d425sbr$V!^(TDO!L_8{fQ z$r`$*=k|p96e>RYX0Ib_WJ+2>?Zja|XznoAtCf_<;C@MRy)q+r)1zE<&XlzM*SMw3 z4pMLj$n(86t?j1tiJamf8`(Xj`h!BvXULu)kEAc;lq*NYNVdAA|1Yf+wI>t~rEO$|Q2Rouovh~yj;mHwzS&)3ixj-;=ZmO6dgC&q^+o%r_MJ0|z+NIK1XCdS*y zBVI##Y1yBN)lJT>vAw&8#$wewW3jN)>V%v|XJ=(N)Do+As;b;#b1b4_wVFfC;gGX$ gpWCi`LNz=S=9&7Mru_7kVEOEK!7KT*fy!?Ge}IML2><{9 diff --git a/rest_framework/locale/pt_BR/LC_MESSAGES/django.mo b/rest_framework/locale/pt_BR/LC_MESSAGES/django.mo index 1dd7287f36ab955d7ab8281100108cc84f22c8dd..482c07cdb98db3dec8f311ac8f3b150e21096025 100644 GIT binary patch delta 26 hcmez8|IdFzv>30su7QQFfw6+2iIu6v<_xiEf&hMq2q^#n delta 26 hcmez8|IdFzv>30Mu7SC(p^<{2sgmRVW9?N>{!_NSR!)1~P^)6i*U&cdjzlI_=Qlet`3FbtxH z3ZhZaQ@;763A2~VpqHSB#Dwape^0$c5QIVW(D$li+|Rl9cXxNr@1EtvgfZ(g}yT}MG zqMC;^$xA=M3r!@8R-4ELyoFKxf$9fg`)YzO*R0e<9 zPLUzz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sk/LC_MESSAGES/django.mo index dda693e32c59738c5bcd1218feb7157b3a5a6078..83d43c8222cc9a35707717997913dba52a1ad0e6 100644 GIT binary patch delta 26 hcmX@?dDwG%;%2Uq|A delta 26 hcmX@?dDwG%->2TuS1 diff --git a/rest_framework/locale/sl/LC_MESSAGES/django.mo b/rest_framework/locale/sl/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..9ac13843f70a0543b748fb73af9bbb41eba8e880 GIT binary patch literal 10390 zcmbuEdyHJyUB_<{H)&1!AV6qZlAdmw)+V0uuI<=n!zT4J*~DINy=#}4w&v{2*_k_Y z=icePcgEh`7!arxm1F)WDt}ZB#TDWY{y;)Pt%^h>zzYH?NDv`aNIZ&=C=wu1@mCcI zKHqciyu7=%ORo0J_dd?!cYg2l+kbpy*H;3rRoYL{&O8tVUjko!kRPt!es>Uj6ub!< z@Xx@fz<&jw0C&G92tEkz1vUOS_+juexEtI6E8rKwec&I04}sqWkAwdXo(A{PS(t$@ zfPVyj61@LMg5V-}0z3kK6?_)_TkvJ@eGdo0EO-gj_pg9wz&F7s!4JJR2p$2S14ZAb zK)sJk{4%Kdz6m}9ejns7*z>-E&cmSg`y8ls>fllE>)`X?cfb?i2j3qARq!()uY&8K z`h6AL1HJ`{k8guN4LO2j%kvY~}#ZkAtXgun3ATm%#7c7X%Ize;1hKaj*kUf!9IN`}-iI z1b+#B4E!hXBj7GRq8h=+z`fuh@DTVpQ0x2#_!9U!cmez#C_R4;CP{yBUh{_J0DDUx`5J<2ool z|1yXugWm)n0{;NS^n-7MqT{bX$@gzS?eD!fBlSNAYF{l7Q3k(MzW*91{(K9Roc|4! zy*-9-)$b)x;~O9%2z~{W-h2am5quMT5PTG7iJr$n@#QH{^PC6Ifxik$FW&;$dhib* ztPk#Ev!ee=P|t@zrVK8E@{89%je8Be5BxN3mWCVfdIb1Oyj4G~txLQdT+$m|&(IK? zzkZfq=@rxZ>*x4=iS{m<_NhH;-{Rq?Xu2fNQ~s`y>1V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+YZqAz3ZNX!5qc?%U@y3+QDKA_nDiA%V;fvlyl+#9*eL5FLucu0 zBa@MK>UL@H4>D>Dn9LAm-Hkf zW3qjEp0?nV(Jss6%MU5`fyyJNEmab@cF+BlPr6!l z>fT38>3=HY)Q+;N0aYq=`M`bqE*+#Td(BEIB9vbh{1DBMZzGT5Oo#v9XEc$s5Qi+hla!?+bs2O?|iIJIY0Gc-xsD82Qt_{>1wROx?cmD@vwL-4| literal 0 HcmV?d00001 diff --git a/rest_framework/locale/sv/LC_MESSAGES/django.mo b/rest_framework/locale/sv/LC_MESSAGES/django.mo index cbecec44db41c28528e50379a8db597b0f7bb909..232b5bceeef9fb4c7b8088db98509889225297e0 100644 GIT binary patch delta 2317 zcmYM#TWl0n9LMp0TY5#%wn!3rKQE*Y;C)=2owrJTMD!wjNR!aw!6B!7>LAG zi5Da>v6TlKiAdl{jSn>#i9V=EVoZ%uNsKX#C@&`J1Mx*{jNjkv5Ki{Y=bYKung2Qe zb7n8^dA>I}SFqrWQHH52sNET6r|?7;2gk=!TcD9&aKaTemnBX#;A+ZKwx@u?gSCcKi`L zaoOEw)p!s&Wv5ZsP2)QJ9yOEm_yCsO!*h7PbW1yOoc^w$ zKZY8~G1SQ3LZ;L{4*K)K_r(l9gY&JZnb^cZsq4d}ZWyPr7GJ}qcnKYx#X|fG7hpOa zvSQh|0Sl02U>$)wkV~x(b)ON`GI|z^@Wr5i7B%1th2&qkzQzfSpma&4g=bhJDxjXgBr0|9VF>?5cBIv>Oa;0L`PeoN8o($v;(65e{0RrO z|JORH8=ORThF!rn`~j7tLiUWdPdirNC~A97qNey9hVWb5g8AjFaNLhlg+Hc#!%>P$XNOY56E_+>xG?No)M zN!COv2}+#iLWLD;kNBTd0py>!^FF+EdC!4^_!k(e@eeTXzm2n!LRHJnO9TmPJ*b zR63|yY?L+r-b*VPRWUDqG#2+F o)y_^u;Km#t;U#WI5wE%v#{1=qvI^pfu@N^C_H5W4ANL#o1K|VzUjP6A delta 2137 zcmYM#e@sArA>IS>;9-PE>{1$b?qUC0{;!4!G z74;_DP)q-WbIP5c!6lqOk6M9wRLU-+?xT~LTCAW`iYfGP5KHhm%*AOW3-$)a@g$ON z`^Nbr@@JPh=ss6b#zx%Q7IlSA^)2BX?Ni{)OZ0^L^p69mfaHMb|-2) ziF$)CP}lv09xkFLSh~V5F6+h+<0;exrtvO3fz3F#g7x1`=PD=kraPE^Ii{WCs5hN- z1|o0U)3U05;!7yc(=ontNF(Y9(4w6G@{!e;#$C*WLINRB@d{ZO4nKef_oI4^1ivqSYvFi5(Gv`9+wAeY&ivV;XjdpZ8p~wQ z#`1I5wlycR|HNXe`}a?b4;}JS`=1^=ba-sk+jw|lJV}hW6OAJi;~leQWt9c9&#bx@ F`VYHh&N~1A diff --git a/rest_framework/locale/tr/LC_MESSAGES/django.mo b/rest_framework/locale/tr/LC_MESSAGES/django.mo index 818aad27929ca67ead8eca3a42804446d8192935..586b494c3235f43b2b20e6ebf1f094336286b3ef 100644 GIT binary patch delta 26 hcmdlMv@K{uj5x2ku7QQFfw6+2iIu6v=1lRkf&g)*2igDt delta 26 hcmdlMv@K{uj5x2Eu7SC(p^<{2sg^J9<-7m%5hfrn+cS_sPs)7M;yZtBdSTTUA}V ztEBM(iA0LJ#1dtfMm20AE??dWUnI;22@(n-vVZjR#*pMCvA#^8Q5uoE-zK90fb&s1q&2LTtrZcnjxZzeM_A z8PX&>Q2Xt{FY!;*lYD_+VZvbMVSbrL;KUNt0lvpY*nuP|MI z?(7%KQ&#&;>`nV~)Dw7#S~44nj$>eWB0&+sQ1qaI+c6mrV;?++R6#CcHufN8msghW zkRP$}kdBjrdVMl64Rfr#6rJQ1s3mSprvAF}J66YMsQD+Qh0;&L3# z_9(y9VgQ@*2Yib=u!iGm#@DzK>qd(Fi1$!m>2H{=0WYKWbB(6Vcpcps&M-s{5$r}6 zjvd45aW$4>6IS7U%dD}ng|y&$+TWqpcr7EvfopL>pT zaS(MVzzUqf{L(^DLc>keS|@Nr^noLIjKyApE<8aL1wQ)wqAVj(tQ z0Y)(i&*40?h+Uvj&A?a30Cz2*zZa|U4mMy$vRN4hu>$|bg*bpSF+U~#dowPge*%BT z=jg_?)OdiosPWm~jhL;ap$Xfu1pAP;edJ4#y3*o1PD3qJj59EdbFc>k_zb6FK{|`! za@2J}oP?)QnY@Ad_zF{5-$oBN^Wj9)1b^ah*nzX~HfqB3AI-*K4ys>{+R3k|)US8! zbjHu%AjYqwGH?@BvL~o{G#HtPV`+@U0D7?zGjKZ¤^b_k2`6jE-x<#-=?+Y`Pt z&pXudNoEocx>5an^r0VB;1VSc}W> zFUQZQKp4l#FM+KO~pGK4V=*8!_NzZ>Wt83w% z_zT{|d6-FlSj+yv)wm5;;s1CHD|n`&co*5MHBKh|xD|EZc?@7bmSQ&bPzmaB0UpGm ztZxr!=!U1L)9K=bsK#Ze3xlZff3O^%I=^QZnDO6Ywa78B6{y;_Ayu>(rr=f7{CBVj z-{UYGU&x;j>zj`T2iL+F#3(A|uTc}O;!lAr+F{gAE+Vno8*IcZW?hL}Q2l#YfqtS^ zMnX6pW4IUxa0~i)1R4}c4-G}yi*xZZ)?y-QIE{6v06(BIkiu;9u^N^7eW?3lsD)on z?+vG9;%w}eA$HhTjtn_4%w ZwKjVz+rptLK26TR)TVH#_r52Z^$m$t$A$m^ diff --git a/rest_framework/locale/zh_CN/LC_MESSAGES/django.mo b/rest_framework/locale/zh_CN/LC_MESSAGES/django.mo index 5ba81a865ad7aef3a93f1a08a8d83700339ef844..00afcdb9a64f237048f4d2880683e581c708e5e8 100644 GIT binary patch delta 2527 zcmYM#e@vBC9LMo4P`xXD-rM;(}mlUxlj(J8Z!Y8qlF*i?RXK#V|tn~qj4(g^A>uETVE z6m#(@%)w)rg1=yeF%dIBWj-A_+%3bn0Q+z*Cfs1mO02|LcmQYPH@E~dZZxI@>rwyj z#Q>hi+i>hn#tg$U)B`R@^@m&|#ym$w10Kgh{1f>z*%|RCEkez>4E05gSd1@YIew3o zIC_XNdAJ7YG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@|3dR6Om@&pDUyR?h#1tUD{YC3sN{l3W``W$Fl$EIaG# zv52VXh9wN+cc>R#L3(J{Fp9NIylg;aXe%nUeeQf3)!`$qeF|@<{S@}#yQu5`aVF?( z8Sl3SDon2pU=u#%oJFmHCDe^!@}^9zMU9{p`N>9c2Tr3pc)|H0YLPCWcGWc;!MgRq zbx)wD2R}oFtl6umIlqW{@Tbn-F+@8;3={0m|BBWGo5L^u*N>VOrlwR2P-PpDBz60gTE(pkWBllzYFt-LxhUvPph|=$R$)#1l!r}Q-h)}-afy^zgb-8 z>Vr$&sVSCJ#>~yN(_opE@x_Z+5gQl>0As3Cs}y diff --git a/rest_framework/locale/zh_Hans/LC_MESSAGES/django.mo b/rest_framework/locale/zh_Hans/LC_MESSAGES/django.mo index 396aded071dcd23c423b058c51168a736bea1410..a784846b2d7c96703a6999d8c77f9186efd9aa49 100644 GIT binary patch delta 2679 zcmYM#dr*{B7{~FmpxnG6f}v@y8mKAWQ9?xl^TtL>sEL+svLdOw49jF{x>#!91uq+8 zW8QNdol+auMDbQy{Zme+U8A8aCVCOBSYzt(wKxux0}00T#e?X?tC)c;_!uT78k3HLP}djWqqq>0a5ZM( zMjV2tF&=-!0%HQEjmi`{hH$p@<5XW>@h$0zWyWS+zG&2%cmaW3ixbvPZHZ~{8IMsGL~d(tkp+m)!9 zyo#FH9%M<)IlFz|{=Em&kEMSCY9;bHD0QV6&<*`m24Dkr$1~`}YuF8c!*&=$gRGc% z9EK^#HZTRYMaZe96m_2p)HYg+kKhKoy%#m%!`;Zga(#;q&7gN`^u%0Ly9BkFd^iR- zqjG%3Zr?*qU_@H?{zb3*WSb|{L{8Sqtoj;3ybk>WMi8MYM_6ku5clmu*XASJHq>jF!d>;C92||)Fc;V01U!q+;9p3(&6Ix8m0W;Y z+104j)LH!jV@^?-MaNfG2O}k6kJB!|Sgb(p>ZPawtVObA4x^Uv60*wXciRqJtn&w8 zEasvfoQE245o#0GN}g}tq@o!$pq6|e>J!<7n!#n%1-E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}PvlBW=ZY?>~I8wf<~T$UCXZUX^{+R;o@xE|q9zKAYXhf-_0Usm&xA+%8*aDdQ7V zePmRWSK69(D*2u%O6J?+>udMlqHy0TduX&#b*}Z%QR$&-&sFq^-ayrs=>(`KpH!Nt zgVg)fp)AN^eV*$yqh-__s*++eRp)alm7|;~^Y|U0Do6Hau4KQ8`XnnK;?Aq{uR6~K z_P9R>l6mfM;i%6k2-di5!G%6|Aaus>1d7tmXGL)*C%nTs5KcMia3Hs#v9{j19u7x# z9~>VWnTR9~K9Za`k~|REa%6n0mHMD}!Ch4x@H_P-9eLM|zj^J%l=Ef9W_P+|GSBT@ g{gls%MmycHXo=5#zHHL(6jy%a%vLryE7o@X3l4nR*8l(j From 1a7ed296395a941c4db0d8ef02855ca079e7ff0b Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 21 Aug 2017 12:06:14 +0200 Subject: [PATCH 11/88] Update version number --- rest_framework/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/__init__.py b/rest_framework/__init__.py index c0b5c4c04..9da9989e9 100644 --- a/rest_framework/__init__.py +++ b/rest_framework/__init__.py @@ -8,7 +8,7 @@ ______ _____ _____ _____ __ """ __title__ = 'Django REST framework' -__version__ = '3.6.3' +__version__ = '3.6.4' __author__ = 'Tom Christie' __license__ = 'BSD 2-Clause' __copyright__ = 'Copyright 2011-2017 Tom Christie' From e389336ad7538b1216e40e57d8c92d178334e2a9 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 21 Aug 2017 14:47:43 +0200 Subject: [PATCH 12/88] docs/link.html: fix/remove undefined template var "schema" --- rest_framework/templates/rest_framework/docs/link.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/templates/rest_framework/docs/link.html b/rest_framework/templates/rest_framework/docs/link.html index f18d64825..fc2320a5f 100644 --- a/rest_framework/templates/rest_framework/docs/link.html +++ b/rest_framework/templates/rest_framework/docs/link.html @@ -99,4 +99,4 @@ -{% include "rest_framework/docs/interact.html" with link=link schema=schema %} +{% include "rest_framework/docs/interact.html" with link=link %} From 0a0bb6a871441bf0db00598eba64222f5bc6d073 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 21 Aug 2017 20:33:51 +0200 Subject: [PATCH 13/88] Update release notes For the last minute #5346 --- docs/topics/release-notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index f4a83324c..78dd334ee 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -67,6 +67,7 @@ You can determine your currently installed version using `pip freeze`: * Revert "Cached the field's root and context property" [#5313][gh5313] * Fix introspection of list field in schema. [#5326][gh5326] * Fix interactive docs for multiple nested and extra methods. [#5334][gh5334] +* Fix/remove undefined template var "schema" [#5346][gh5346] ### 3.6.3 @@ -1391,6 +1392,7 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh5117]: https://github.com/encode/django-rest-framework/issues/5117 +[gh5346]: https://github.com/encode/django-rest-framework/issues/5346 [gh5334]: https://github.com/encode/django-rest-framework/issues/5334 [gh5326]: https://github.com/encode/django-rest-framework/issues/5326 [gh5313]: https://github.com/encode/django-rest-framework/issues/5313 From 5fd01d06ab375c10f8821863617277fddd2a422c Mon Sep 17 00:00:00 2001 From: Felipe Bidu Date: Tue, 22 Aug 2017 11:00:19 -0300 Subject: [PATCH 14/88] Adding a more explicit error message when a view does have a get_queryset method but it returned nothing --- rest_framework/permissions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index f24775278..484630ae7 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -122,6 +122,9 @@ class DjangoModelPermissions(BasePermission): if hasattr(view, 'get_queryset'): queryset = view.get_queryset() + assert queryset is not None, ( + 'The `.get_queryset()` method from the view did not return anything.' + ) else: queryset = getattr(view, 'queryset', None) From 6f2c3bcb1287db58a191ab7ee4d9723a3377e716 Mon Sep 17 00:00:00 2001 From: Felipe Bidu Date: Tue, 22 Aug 2017 12:13:22 -0300 Subject: [PATCH 15/88] Further clarifying the message when get_queryset returns None to include the class name that was called --- rest_framework/permissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 484630ae7..01b74e877 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -123,7 +123,7 @@ class DjangoModelPermissions(BasePermission): if hasattr(view, 'get_queryset'): queryset = view.get_queryset() assert queryset is not None, ( - 'The `.get_queryset()` method from the view did not return anything.' + 'Return of {}.get_queryset() was None'.format(view.__class__.__name__) ) else: queryset = getattr(view, 'queryset', None) From 9b829bec2d0bb687c356b4c57091d175e9282fcd Mon Sep 17 00:00:00 2001 From: qwhex Date: Tue, 22 Aug 2017 20:37:31 +0200 Subject: [PATCH 16/88] Update 2-requests-and-responses.md: consistency Made it consistent with Part I. Catched it when commiting the code into my local tutorial repo. --- docs/tutorial/2-requests-and-responses.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md index 5c020a1f7..bba52d82e 100644 --- a/docs/tutorial/2-requests-and-responses.md +++ b/docs/tutorial/2-requests-and-responses.md @@ -47,7 +47,7 @@ We don't need our `JSONResponse` class in `views.py` anymore, so go ahead and de @api_view(['GET', 'POST']) def snippet_list(request): """ - List all snippets, or create a new snippet. + List all code snippets, or create a new snippet. """ if request.method == 'GET': snippets = Snippet.objects.all() @@ -68,7 +68,7 @@ Here is the view for an individual snippet, in the `views.py` module. @api_view(['GET', 'PUT', 'DELETE']) def snippet_detail(request, pk): """ - Retrieve, update or delete a snippet instance. + Retrieve, update or delete a code snippet. """ try: snippet = Snippet.objects.get(pk=pk) From 6a3b8cfa4c2622ce38c5e0b217fcc5acb624a701 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 22 Aug 2017 20:44:19 +0200 Subject: [PATCH 17/88] Adjust wording --- rest_framework/permissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 01b74e877..57de3a35c 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -123,7 +123,7 @@ class DjangoModelPermissions(BasePermission): if hasattr(view, 'get_queryset'): queryset = view.get_queryset() assert queryset is not None, ( - 'Return of {}.get_queryset() was None'.format(view.__class__.__name__) + '{}.get_queryset() returned None'.format(view.__class__.__name__) ) else: queryset = getattr(view, 'queryset', None) From eb88687e28a8c75fff1e875d3a1568cd51a35c99 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Tue, 22 Aug 2017 15:02:18 -0400 Subject: [PATCH 18/88] Test RequestFactory with empty body --- tests/test_testing.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_testing.py b/tests/test_testing.py index 4a68a1e1e..ba42da971 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -274,3 +274,12 @@ class TestAPIRequestFactory(TestCase): assert dict(request.GET) == {'demo': ['testé']} request = factory.get('/view/', {'demo': 'testé'}) assert dict(request.GET) == {'demo': ['testé']} + + def test_empty_request_content_type(self): + factory = APIRequestFactory() + request = factory.post( + '/post-view/', + data=None, + content_type='application/json', + ) + assert request.content_type == 'application/json' From 807b9c716ca2cf6131993828ba37d37cfa673b98 Mon Sep 17 00:00:00 2001 From: Scott Kelly Date: Wed, 23 Aug 2017 21:30:56 -0500 Subject: [PATCH 19/88] Fix doc Response data attribute description --- docs/api-guide/responses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/responses.md b/docs/api-guide/responses.md index 8ee14eefa..e9c2d41f1 100644 --- a/docs/api-guide/responses.md +++ b/docs/api-guide/responses.md @@ -42,7 +42,7 @@ Arguments: ## .data -The unrendered content of a `Request` object. +The unrendered, serialized data of the response. ## .status_code From 26d4977cd065e54cee54e77d8998d11af458a3b6 Mon Sep 17 00:00:00 2001 From: Ashish Patil Date: Thu, 24 Aug 2017 15:06:48 +0400 Subject: [PATCH 20/88] ~api-clients documentation: installation code fix --- docs/topics/api-clients.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/topics/api-clients.md b/docs/topics/api-clients.md index 73434416d..85c806428 100644 --- a/docs/topics/api-clients.md +++ b/docs/topics/api-clients.md @@ -419,7 +419,7 @@ The `SessionAuthentication` class allows session cookies to provide the user authentication. You'll want to provide a standard HTML login flow, to allow the user to login, and then instantiate a client using session authentication: - let auth = coreapi.auth.SessionAuthentication({ + let auth = new coreapi.auth.SessionAuthentication({ csrfCookieName: 'csrftoken', csrfHeaderName: 'X-CSRFToken' }) @@ -433,7 +433,7 @@ requests for unsafe HTTP methods. The `TokenAuthentication` class can be used to support REST framework's built-in `TokenAuthentication`, as well as OAuth and JWT schemes. - let auth = coreapi.auth.TokenAuthentication({ + let auth = new coreapi.auth.TokenAuthentication({ scheme: 'JWT' token: '' }) @@ -471,7 +471,7 @@ For example, using the "Django REST framework JWT" package The `BasicAuthentication` class can be used to support HTTP Basic Authentication. - let auth = coreapi.auth.BasicAuthentication({ + let auth = new coreapi.auth.BasicAuthentication({ username: '', password: '' }) From c0475d059d500f4ab8abf394305df7c65856eec1 Mon Sep 17 00:00:00 2001 From: Vadim Laletin Date: Tue, 29 Aug 2017 10:39:52 +0700 Subject: [PATCH 21/88] Update link to drf-writable-nested repository in third-party serializers --- docs/api-guide/serializers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index a3f7fdcc1..e95f2849b 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -1180,4 +1180,4 @@ The [drf-writable-nested][drf-writable-nested] package provides writable nested [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 +[drf-writable-nested]: http://github.com/beda-software/drf-writable-nested From ff2fa7a8663bdcdf962d31277bc8e29d22a2943e Mon Sep 17 00:00:00 2001 From: Benedek Kiss Date: Tue, 29 Aug 2017 22:22:00 +0200 Subject: [PATCH 22/88] Fix excludes I definitely see files from `__pycache__` as well as `.pyc` files in the package. Fixed according to https://www.reddit.com/r/Python/comments/40s8qw/simplify_your_manifestin_commands and https://github.com/django/django/pull/5817 --- MANIFEST.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 66488aae6..15bfe4caa 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,5 +2,5 @@ include README.md include LICENSE.md recursive-include rest_framework/static *.js *.css *.png *.eot *.svg *.ttf *.woff recursive-include rest_framework/templates *.html -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] +global-exclude __pycache__ +global-exclude *.py[co] From 94e5d05caa285180356fa36e946433b5c93745b1 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 30 Aug 2017 14:06:43 -0400 Subject: [PATCH 23/88] Add failing test for #5371 --- tests/test_serializer.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_serializer.py b/tests/test_serializer.py index 91430a193..3044d7c6b 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -411,6 +411,19 @@ class TestDefaultOutput: serializer = self.Serializer(instance) assert serializer.data == {'has_default': 'def', 'has_default_callable': 'ghi', 'no_default': 'abc'} + def test_default_for_source_source(self): + """ + 'default="something"' should be used when a traversed attribute is missing from input. + """ + class Serializer(serializers.Serializer): + traversed = serializers.CharField(default='x', source='traversed.attr') + + assert Serializer({}).data == {'traversed': 'x'} + assert Serializer({'traversed': {}}).data == {'traversed': 'x'} + assert Serializer({'traversed': None}).data == {'traversed': 'x'} + + assert Serializer({'traversed': {'attr': 'abc'}}).data == {'traversed': 'abc'} + class TestCacheSerializerData: def test_cache_serializer_data(self): From 79c1f2154adfbb13fa5d7e24e9624afa41652a6c Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 30 Aug 2017 16:52:16 -0400 Subject: [PATCH 24/88] Fix authorization few perms tests --- tests/test_permissions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_permissions.py b/tests/test_permissions.py index 6fbf766a0..70fb38caa 100644 --- a/tests/test_permissions.py +++ b/tests/test_permissions.py @@ -201,11 +201,11 @@ class ModelPermissionsIntegrationTests(TestCase): self.assertEqual(response.status_code, status.HTTP_200_OK) def test_calling_method_not_allowed(self): - request = factory.generic('METHOD_NOT_ALLOWED', '/') + request = factory.generic('METHOD_NOT_ALLOWED', '/', HTTP_AUTHORIZATION=self.permitted_credentials) response = root_view(request) self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) - request = factory.generic('METHOD_NOT_ALLOWED', '/1') + request = factory.generic('METHOD_NOT_ALLOWED', '/1', HTTP_AUTHORIZATION=self.permitted_credentials) response = instance_view(request, pk='1') self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) @@ -396,7 +396,7 @@ class ObjectPermissionsIntegrationTests(TestCase): self.assertListEqual(response.data, []) def test_cannot_method_not_allowed(self): - request = factory.generic('METHOD_NOT_ALLOWED', '/') + request = factory.generic('METHOD_NOT_ALLOWED', '/', HTTP_AUTHORIZATION=self.credentials['readonly']) response = object_permissions_list_view(request) self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) From 2ea368e80f16311f50b31563abb70571b95fff86 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 30 Aug 2017 16:53:08 -0400 Subject: [PATCH 25/88] Add failing test for #5367 --- tests/test_permissions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_permissions.py b/tests/test_permissions.py index 70fb38caa..ed5c7af7a 100644 --- a/tests/test_permissions.py +++ b/tests/test_permissions.py @@ -209,6 +209,16 @@ class ModelPermissionsIntegrationTests(TestCase): response = instance_view(request, pk='1') self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED) + def test_check_auth_before_queryset_call(self): + class View(RootView): + def get_queryset(_): + self.fail('should not reach due to auth check') + view = View.as_view() + + request = factory.get('/', HTTP_AUTHORIZATION='') + response = view(request) + self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) + class BasicPermModel(models.Model): text = models.CharField(max_length=100) From c8773671e7adfe8e9de162f3215470f0ed879f23 Mon Sep 17 00:00:00 2001 From: Denis Untevskiy Date: Fri, 25 Aug 2017 22:14:33 +0200 Subject: [PATCH 26/88] + Rejecting anonymous in DjangoModelPermissions *before* the .get_queryset call --- rest_framework/permissions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 57de3a35c..26728b2d6 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -120,6 +120,10 @@ class DjangoModelPermissions(BasePermission): if getattr(view, '_ignore_model_permissions', False): return True + if not request.user or ( + not is_authenticated(request.user) and self.authenticated_users_only): + return False + if hasattr(view, 'get_queryset'): queryset = view.get_queryset() assert queryset is not None, ( @@ -135,11 +139,7 @@ class DjangoModelPermissions(BasePermission): perms = self.get_required_permissions(request.method, queryset.model) - return ( - request.user and - (is_authenticated(request.user) or not self.authenticated_users_only) and - request.user.has_perms(perms) - ) + return request.user.has_perms(perms) class DjangoModelPermissionsOrAnonReadOnly(DjangoModelPermissions): From 07258ca032e062334310c112469d6432f6eeb818 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 30 Aug 2017 14:15:33 -0400 Subject: [PATCH 27/88] Remove None handling from fields.get_attribute() --- rest_framework/fields.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 242d0f978..5730ca571 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -93,9 +93,6 @@ def get_attribute(instance, attrs): Also accepts either attribute lookup on objects or dictionary lookups. """ for attr in attrs: - if instance is None: - # Break out early if we get `None` at any point in a nested lookup. - return None try: if isinstance(instance, collections.Mapping): instance = instance[attr] From 0ec915e6234bdc602e131f08e8cff46fcf3dc3ff Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 30 Aug 2017 21:36:05 -0400 Subject: [PATCH 28/88] Force content_type inclusion in APIRequestFactory --- rest_framework/request.py | 2 +- rest_framework/test.py | 9 +++++++++ tests/test_testing.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/rest_framework/request.py b/rest_framework/request.py index 6f4269fe5..4f413e03f 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -303,7 +303,7 @@ class Request(object): stream = None if stream is None or media_type is None: - if media_type and not is_form_media_type(media_type): + if media_type and is_form_media_type(media_type): empty_data = QueryDict('', encoding=self._request._encoding) else: empty_data = {} diff --git a/rest_framework/test.py b/rest_framework/test.py index 87255bca0..ebad19a4e 100644 --- a/rest_framework/test.py +++ b/rest_framework/test.py @@ -227,6 +227,15 @@ class APIRequestFactory(DjangoRequestFactory): data, content_type = self._encode_data(data, format, content_type) return self.generic('OPTIONS', path, data, content_type, **extra) + def generic(self, method, path, data='', + content_type='application/octet-stream', secure=False, **extra): + # Include the CONTENT_TYPE, regardless of whether or not data is empty. + if content_type is not None: + extra['CONTENT_TYPE'] = str(content_type) + + return super(APIRequestFactory, self).generic( + method, path, data, content_type, secure, **extra) + def request(self, **kwargs): request = super(APIRequestFactory, self).request(**kwargs) request._dont_enforce_csrf_checks = not self.enforce_csrf_checks diff --git a/tests/test_testing.py b/tests/test_testing.py index ba42da971..1af6ef02e 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -282,4 +282,4 @@ class TestAPIRequestFactory(TestCase): data=None, content_type='application/json', ) - assert request.content_type == 'application/json' + assert request.META['CONTENT_TYPE'] == 'application/json' From fff3db5517ef80ce0ecb7448feba5aeca46d85d3 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 31 Aug 2017 12:19:03 +0200 Subject: [PATCH 29/88] Fix doc for ErrorDetail --- rest_framework/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py index aac31c453..7cc3ba049 100644 --- a/rest_framework/exceptions.py +++ b/rest_framework/exceptions.py @@ -64,7 +64,7 @@ def _get_full_details(detail): class ErrorDetail(six.text_type): """ - A string-like object that can additionally + A string-like object that can additionally have a code. """ code = None From bc49746dd37e22385facfe509bf4bb89582e7f98 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Thu, 31 Aug 2017 08:26:14 -0400 Subject: [PATCH 30/88] Fix test name --- tests/test_serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_serializer.py b/tests/test_serializer.py index 3044d7c6b..af5206a9f 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -411,7 +411,7 @@ class TestDefaultOutput: serializer = self.Serializer(instance) assert serializer.data == {'has_default': 'def', 'has_default_callable': 'ghi', 'no_default': 'abc'} - def test_default_for_source_source(self): + def test_default_for_dotted_source(self): """ 'default="something"' should be used when a traversed attribute is missing from input. """ From af460d2b6906ebce0680105f36eeada867a35d7e Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 1 Sep 2017 13:37:01 -0400 Subject: [PATCH 31/88] Add PR 5376 to release notes --- docs/topics/release-notes.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 78dd334ee..f4617ac23 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -40,6 +40,10 @@ You can determine your currently installed version using `pip freeze`: ## 3.6.x series +### 3.6.5 + +* Fix `DjangoModelPermissions` to ensure user authentication before calling the view's `get_queryset()` method. As a side effect, this changes the order of the HTTP method permissions and authentication checks, and 405 responses will only be returned when authenticated. If you want to replicate the old behavior, see the PR for details. [#5376][gh5376] + ### 3.6.4 **Date**: [21st August 2017][3.6.4-milestone] @@ -1417,5 +1421,5 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh5147]: https://github.com/encode/django-rest-framework/issues/5147 [gh5131]: https://github.com/encode/django-rest-framework/issues/5131 - - + +[gh5376]: https://github.com/encode/django-rest-framework/issues/5376 From 23b2d8099bbcdf509c177c06eb56ab8b58bf5b8b Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 1 Sep 2017 13:37:58 -0400 Subject: [PATCH 32/88] Unify QS handling for model/object permissions --- rest_framework/permissions.py | 41 +++++++++++++++-------------------- tests/test_permissions.py | 23 +++++++++++++++++++- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 26728b2d6..dee0032f9 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -114,6 +114,21 @@ class DjangoModelPermissions(BasePermission): return [perm % kwargs for perm in self.perms_map[method]] + def _queryset(self, view): + assert hasattr(view, 'get_queryset') \ + or getattr(view, 'queryset', None) is not None, ( + 'Cannot apply {} on a view that does not set ' + '`.queryset` or have a `.get_queryset()` method.' + ).format(self.__class__.__name__) + + if hasattr(view, 'get_queryset'): + queryset = view.get_queryset() + assert queryset is not None, ( + '{}.get_queryset() returned None'.format(view.__class__.__name__) + ) + return queryset + return view.queryset + def has_permission(self, request, view): # Workaround to ensure DjangoModelPermissions are not applied # to the root view when using DefaultRouter. @@ -124,19 +139,7 @@ class DjangoModelPermissions(BasePermission): not is_authenticated(request.user) and self.authenticated_users_only): return False - if hasattr(view, 'get_queryset'): - queryset = view.get_queryset() - assert queryset is not None, ( - '{}.get_queryset() returned None'.format(view.__class__.__name__) - ) - else: - queryset = getattr(view, 'queryset', None) - - assert queryset is not None, ( - 'Cannot apply DjangoModelPermissions on a view that ' - 'does not set `.queryset` or have a `.get_queryset()` method.' - ) - + queryset = self._queryset(view) perms = self.get_required_permissions(request.method, queryset.model) return request.user.has_perms(perms) @@ -183,16 +186,8 @@ class DjangoObjectPermissions(DjangoModelPermissions): return [perm % kwargs for perm in self.perms_map[method]] def has_object_permission(self, request, view, obj): - if hasattr(view, 'get_queryset'): - queryset = view.get_queryset() - else: - queryset = getattr(view, 'queryset', None) - - assert queryset is not None, ( - 'Cannot apply DjangoObjectPermissions on a view that ' - 'does not set `.queryset` or have a `.get_queryset()` method.' - ) - + # authentication checks have already executed via has_permission + queryset = self._queryset(view) model_cls = queryset.model user = request.user diff --git a/tests/test_permissions.py b/tests/test_permissions.py index ed5c7af7a..f673c3671 100644 --- a/tests/test_permissions.py +++ b/tests/test_permissions.py @@ -9,7 +9,7 @@ from django.test import TestCase from rest_framework import ( HTTP_HEADER_ENCODING, authentication, generics, permissions, serializers, - status + status, views ) from rest_framework.compat import ResolverMatch, guardian, set_many from rest_framework.filters import DjangoObjectPermissionsFilter @@ -219,6 +219,27 @@ class ModelPermissionsIntegrationTests(TestCase): response = view(request) self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) + def test_queryset_assertions(self): + class View(views.APIView): + authentication_classes = [authentication.BasicAuthentication] + permission_classes = [permissions.DjangoModelPermissions] + view = View.as_view() + + request = factory.get('/', HTTP_AUTHORIZATION=self.permitted_credentials) + msg = 'Cannot apply DjangoModelPermissions on a view that does not set `.queryset` or have a `.get_queryset()` method.' + with self.assertRaisesMessage(AssertionError, msg): + view(request) + + # Faulty `get_queryset()` methods should trigger the above "view does not have a queryset" assertion. + class View(RootView): + def get_queryset(self): + return None + view = View.as_view() + + request = factory.get('/', HTTP_AUTHORIZATION=self.permitted_credentials) + with self.assertRaisesMessage(AssertionError, 'View.get_queryset() returned None'): + view(request) + class BasicPermModel(models.Model): text = models.CharField(max_length=100) From e42eb42d4912f1541bebfb220ab0a9c4d0e08c08 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 4 Sep 2017 10:04:48 +0100 Subject: [PATCH 33/88] Don't make the content mandatory in the generic content form (#5372) Sometimes, probably in the upgrade from Django 1.9 to 1.10, a post with empty content is forbidden by javascript, with the message "Please fill in this field". Filling the form with '{}' allows an application/json request to be submitted. The API call itself works perfectly well with a post with empty content: the interface shouldn't make assumptions about it. --- rest_framework/renderers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index 779f0dd44..687cb0e1e 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -579,7 +579,8 @@ class BrowsableAPIRenderer(BaseRenderer): _content = forms.CharField( label='Content', widget=forms.Textarea(attrs={'data-override': 'content'}), - initial=content + initial=content, + required=False ) return GenericContentForm() From 79be20a7c68e7c90dd4d5d23a9e6ee08b5f586ae Mon Sep 17 00:00:00 2001 From: Igor Tokarev Date: Mon, 4 Sep 2017 14:11:53 +0500 Subject: [PATCH 34/88] Updated supported values for the NullBooleanField (#5387) * Updated supported values for the NullBooleanField. * Added check for unhashable types in NullBooleanField. --- rest_framework/fields.py | 33 +++++++++++++++++++++++++-------- tests/test_fields.py | 4 ++-- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 5730ca571..d2079d5d6 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -688,8 +688,22 @@ class NullBooleanField(Field): 'invalid': _('"{input}" is not a valid boolean.') } initial = None - TRUE_VALUES = {'t', 'T', 'true', 'True', 'TRUE', '1', 1, True} - FALSE_VALUES = {'f', 'F', 'false', 'False', 'FALSE', '0', 0, 0.0, False} + TRUE_VALUES = { + 't', 'T', + 'y', 'Y', 'yes', 'YES', + 'true', 'True', 'TRUE', + 'on', 'On', 'ON', + '1', 1, + True + } + FALSE_VALUES = { + 'f', 'F', + 'n', 'N', 'no', 'NO', + 'false', 'False', 'FALSE', + 'off', 'Off', 'OFF', + '0', 0, 0.0, + False + } NULL_VALUES = {'n', 'N', 'null', 'Null', 'NULL', '', None} def __init__(self, **kwargs): @@ -698,12 +712,15 @@ class NullBooleanField(Field): super(NullBooleanField, self).__init__(**kwargs) def to_internal_value(self, data): - if data in self.TRUE_VALUES: - return True - elif data in self.FALSE_VALUES: - return False - elif data in self.NULL_VALUES: - return None + try: + if data in self.TRUE_VALUES: + return True + elif data in self.FALSE_VALUES: + return False + elif data in self.NULL_VALUES: + return None + except TypeError: # Input is an unhashable type + pass self.fail('invalid', input=data) def to_representation(self, value): diff --git a/tests/test_fields.py b/tests/test_fields.py index d6b233227..c3d2bf57d 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -587,7 +587,7 @@ class TestBooleanField(FieldValues): [], {}, ) - field = serializers.BooleanField() + field = self.field for input_value in inputs: with pytest.raises(serializers.ValidationError) as exc_info: field.run_validation(input_value) @@ -595,7 +595,7 @@ class TestBooleanField(FieldValues): assert exc_info.value.detail == expected -class TestNullBooleanField(FieldValues): +class TestNullBooleanField(TestBooleanField): """ Valid and invalid values for `BooleanField`. """ From 3c1bf6bfd5d69f36c822f92d0bb22a6f338c6431 Mon Sep 17 00:00:00 2001 From: jhg14 Date: Mon, 4 Sep 2017 11:47:53 +0100 Subject: [PATCH 35/88] Add failing test for named attribute Fix test crudely Remove comment --- rest_framework/serializers.py | 4 +++- tests/test_model_serializer.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index a4b51ae9d..b1c34b92a 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -1010,7 +1010,9 @@ class ModelSerializer(Serializer): continue extra_field_kwargs = extra_kwargs.get(field_name, {}) - source = extra_field_kwargs.get('source', '*') != '*' or field_name + source = extra_field_kwargs.get('source', '*') + if source == '*': + source = field_name # Determine the serializer field class and keyword arguments. field_class, field_kwargs = self.build_field( diff --git a/tests/test_model_serializer.py b/tests/test_model_serializer.py index ba3edd389..ce054f695 100644 --- a/tests/test_model_serializer.py +++ b/tests/test_model_serializer.py @@ -557,6 +557,39 @@ class TestRelationalFieldMappings(TestCase): self.maxDiff = None self.assertEqual(unicode_repr(TestSerializer()), expected) + def test_nested_hyperlinked_relations_named_source(self): + class TestSerializer(serializers.HyperlinkedModelSerializer): + class Meta: + model = RelationalModel + depth = 1 + fields = '__all__' + + extra_kwargs = { + 'url': { + 'source': 'url' + }} + + expected = dedent(""" + TestSerializer(): + url = HyperlinkedIdentityField(source='url', view_name='relationalmodel-detail') + foreign_key = NestedSerializer(read_only=True): + url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail') + name = CharField(max_length=100) + one_to_one = NestedSerializer(read_only=True): + url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail') + name = CharField(max_length=100) + many_to_many = NestedSerializer(many=True, read_only=True): + url = HyperlinkedIdentityField(view_name='manytomanytargetmodel-detail') + name = CharField(max_length=100) + through = NestedSerializer(many=True, read_only=True): + url = HyperlinkedIdentityField(view_name='throughtargetmodel-detail') + name = CharField(max_length=100) + """) + self.maxDiff = None + self.assertEqual(unicode_repr(TestSerializer()), expected) + + + def test_nested_unique_together_relations(self): class TestSerializer(serializers.HyperlinkedModelSerializer): class Meta: From 43458944452fe11132fa1ab5f2bf1934b8fc108f Mon Sep 17 00:00:00 2001 From: jhg14 Date: Mon, 4 Sep 2017 15:41:04 +0100 Subject: [PATCH 36/88] Add simplest possible failing test --- tests/test_model_serializer.py | 55 ++++++++++++++-------------------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/tests/test_model_serializer.py b/tests/test_model_serializer.py index ce054f695..430be71c6 100644 --- a/tests/test_model_serializer.py +++ b/tests/test_model_serializer.py @@ -557,39 +557,6 @@ class TestRelationalFieldMappings(TestCase): self.maxDiff = None self.assertEqual(unicode_repr(TestSerializer()), expected) - def test_nested_hyperlinked_relations_named_source(self): - class TestSerializer(serializers.HyperlinkedModelSerializer): - class Meta: - model = RelationalModel - depth = 1 - fields = '__all__' - - extra_kwargs = { - 'url': { - 'source': 'url' - }} - - expected = dedent(""" - TestSerializer(): - url = HyperlinkedIdentityField(source='url', view_name='relationalmodel-detail') - foreign_key = NestedSerializer(read_only=True): - url = HyperlinkedIdentityField(view_name='foreignkeytargetmodel-detail') - name = CharField(max_length=100) - one_to_one = NestedSerializer(read_only=True): - url = HyperlinkedIdentityField(view_name='onetoonetargetmodel-detail') - name = CharField(max_length=100) - many_to_many = NestedSerializer(many=True, read_only=True): - url = HyperlinkedIdentityField(view_name='manytomanytargetmodel-detail') - name = CharField(max_length=100) - through = NestedSerializer(many=True, read_only=True): - url = HyperlinkedIdentityField(view_name='throughtargetmodel-detail') - name = CharField(max_length=100) - """) - self.maxDiff = None - self.assertEqual(unicode_repr(TestSerializer()), expected) - - - def test_nested_unique_together_relations(self): class TestSerializer(serializers.HyperlinkedModelSerializer): class Meta: @@ -1168,3 +1135,25 @@ class Test5004UniqueChoiceField(TestCase): serializer = TestUniqueChoiceSerializer(data={'name': 'choice1'}) assert not serializer.is_valid() assert serializer.errors == {'name': ['unique choice model with this name already exists.']} + +class TestFieldSource(TestCase): + + def test_named_field_source(self): + class TestSerializer(serializers.ModelSerializer): + + class Meta: + model = RegularFieldsModel + fields = ('number_field',) + extra_kwargs = { + 'number_field': { + 'source': 'integer_field' + } + } + + expected = dedent(""" + TestSerializer(): + number_field = IntegerField(source='integer_field') + """) + self.maxDiff = None + self.assertEqual(unicode_repr(TestSerializer()), expected) + From 66b2c6149ed0121b1064fe42615aaa8d75aa5d8b Mon Sep 17 00:00:00 2001 From: jhg14 Date: Mon, 4 Sep 2017 16:17:43 +0100 Subject: [PATCH 37/88] Fix code style --- tests/test_model_serializer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_model_serializer.py b/tests/test_model_serializer.py index 430be71c6..3411c44b5 100644 --- a/tests/test_model_serializer.py +++ b/tests/test_model_serializer.py @@ -1136,13 +1136,13 @@ class Test5004UniqueChoiceField(TestCase): assert not serializer.is_valid() assert serializer.errors == {'name': ['unique choice model with this name already exists.']} + class TestFieldSource(TestCase): - def test_named_field_source(self): class TestSerializer(serializers.ModelSerializer): class Meta: - model = RegularFieldsModel + model = RegularFieldsModel fields = ('number_field',) extra_kwargs = { 'number_field': { @@ -1156,4 +1156,3 @@ class TestFieldSource(TestCase): """) self.maxDiff = None self.assertEqual(unicode_repr(TestSerializer()), expected) - From b11f37eaf314b983c7a21abcea231f69ea31da1b Mon Sep 17 00:00:00 2001 From: Irvan Date: Thu, 7 Sep 2017 11:06:44 +0800 Subject: [PATCH 38/88] Fixed the MultipleFieldLookupMixin example to properly check for object level permission. --- docs/api-guide/generic-views.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md index 0170256f2..381f1fe73 100644 --- a/docs/api-guide/generic-views.md +++ b/docs/api-guide/generic-views.md @@ -330,7 +330,9 @@ For example, if you need to lookup objects based on multiple fields in the URL c for field in self.lookup_fields: if self.kwargs[field]: # Ignore empty fields. filter[field] = self.kwargs[field] - return get_object_or_404(queryset, **filter) # Lookup the object + obj = get_object_or_404(queryset, **filter) # Lookup the object + self.check_object_permissions(self.request, obj) + return obj You can then simply apply this mixin to a view or viewset anytime you need to apply the custom behavior. From 13222e45bcbf6492fee59ef85c88c3eae0a4b74e Mon Sep 17 00:00:00 2001 From: ersel-ionova <31036948+ersel-ionova@users.noreply.github.com> Date: Fri, 8 Sep 2017 16:53:17 +0100 Subject: [PATCH 39/88] Make status_code documentation more readable. (#5400) * Make status_code documentation more readable. * Update status-codes.md --- docs/api-guide/status-codes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/status-codes.md b/docs/api-guide/status-codes.md index f6ec3598f..16a0e63c8 100644 --- a/docs/api-guide/status-codes.md +++ b/docs/api-guide/status-codes.md @@ -6,7 +6,7 @@ source: status.py > > — [RFC 2324][rfc2324], Hyper Text Coffee Pot Control Protocol -Using bare status codes in your responses isn't recommended. REST framework includes a set of named constants that you can use to make more code more obvious and readable. +Using bare status codes in your responses isn't recommended. REST framework includes a set of named constants that you can use to make your code more obvious and readable. from rest_framework import status from rest_framework.response import Response From 0e341c24b49c1ae8011fd4e99a13e9cb43ea64f5 Mon Sep 17 00:00:00 2001 From: Sanjuro Jogdeo Date: Fri, 8 Sep 2017 09:51:16 -0700 Subject: [PATCH 40/88] Update get_object() example in permissions.md (#5401) * Update get_object() example in permissions.md I'm a bit confused about the example that's provided in the 'Object level permissions' section. Other examples (e.g. Tutorial 3 - Class Based Views) provided a pk to get_object(). It doesn't seem like this example has any way of identifying a specific object. Just in case I'm correct, I've prepared this pull request. But if I'm wrong, would it be possible for you to explain the example I modified? Many Thanks... * Adjust patch --- docs/api-guide/permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index 548b14438..ef9ce3abd 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -44,7 +44,7 @@ This will either raise a `PermissionDenied` or `NotAuthenticated` exception, or For example: def get_object(self): - obj = get_object_or_404(self.get_queryset()) + obj = get_object_or_404(self.get_queryset(), pk=self.kwargs["pk"]) self.check_object_permissions(self.request, obj) return obj From ae95ed1ec2514becb6e2e41d47b8fd3c8b9c8f66 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 11 Sep 2017 05:18:39 -0400 Subject: [PATCH 41/88] Add repr(value) to the assert msg in FieldValues --- tests/test_fields.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_fields.py b/tests/test_fields.py index c3d2bf57d..4173e6ab5 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -533,7 +533,8 @@ class FieldValues: Ensure that valid values return the expected validated data. """ for input_value, expected_output in get_items(self.valid_inputs): - assert self.field.run_validation(input_value) == expected_output + assert self.field.run_validation(input_value) == expected_output, \ + 'input value: {}'.format(repr(input_value)) def test_invalid_inputs(self): """ @@ -542,11 +543,13 @@ class FieldValues: for input_value, expected_failure in get_items(self.invalid_inputs): with pytest.raises(serializers.ValidationError) as exc_info: self.field.run_validation(input_value) - assert exc_info.value.detail == expected_failure + assert exc_info.value.detail == expected_failure, \ + 'input value: {}'.format(repr(input_value)) def test_outputs(self): for output_value, expected_output in get_items(self.outputs): - assert self.field.to_representation(output_value) == expected_output + assert self.field.to_representation(output_value) == expected_output, \ + 'output value: {}'.format(repr(output_value)) # Boolean types... From 7037ce88e94665076b33919917d44308e13ef027 Mon Sep 17 00:00:00 2001 From: Jozef Date: Tue, 12 Sep 2017 13:08:32 +0200 Subject: [PATCH 42/88] Fix throttling documentation about Remote-Addr (#5414) Clarify in docs that REMOTE_ADDR is part of the WSGI environ, not an HTTP header. --- docs/api-guide/throttling.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-guide/throttling.md b/docs/api-guide/throttling.md index 58578a23e..10a0bb087 100644 --- a/docs/api-guide/throttling.md +++ b/docs/api-guide/throttling.md @@ -68,9 +68,9 @@ Or, if you're using the `@api_view` decorator with function based views. ## How clients are identified -The `X-Forwarded-For` and `Remote-Addr` HTTP headers are used to uniquely identify client IP addresses for throttling. If the `X-Forwarded-For` header is present then it will be used, otherwise the value of the `Remote-Addr` header will be used. +The `X-Forwarded-For` HTTP header and `REMOTE_ADDR` WSGI variable are used to uniquely identify client IP addresses for throttling. If the `X-Forwarded-For` header is present then it will be used, otherwise the value of the `REMOTE_ADDR` variable from the WSGI environment will be used. -If you need to strictly identify unique client IP addresses, you'll need to first configure the number of application proxies that the API runs behind by setting the `NUM_PROXIES` setting. This setting should be an integer of zero or more. If set to non-zero then the client IP will be identified as being the last IP address in the `X-Forwarded-For` header, once any application proxy IP addresses have first been excluded. If set to zero, then the `Remote-Addr` header will always be used as the identifying IP address. +If you need to strictly identify unique client IP addresses, you'll need to first configure the number of application proxies that the API runs behind by setting the `NUM_PROXIES` setting. This setting should be an integer of zero or more. If set to non-zero then the client IP will be identified as being the last IP address in the `X-Forwarded-For` header, once any application proxy IP addresses have first been excluded. If set to zero, then the `REMOTE_ADDR` value will always be used as the identifying IP address. It is important to understand that if you configure the `NUM_PROXIES` setting, then all clients behind a unique [NAT'd](http://en.wikipedia.org/wiki/Network_address_translation) gateway will be treated as a single client. From 9aaea2586bf5a5fab0294943d069e92969b497f2 Mon Sep 17 00:00:00 2001 From: Sergei Azarkin Date: Tue, 12 Sep 2017 16:03:29 +0300 Subject: [PATCH 43/88] Fix authtoken managment command (#5415) * Fix authtoken managment command username param --- .../authtoken/management/commands/drf_create_token.py | 2 +- tests/test_authtoken.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/rest_framework/authtoken/management/commands/drf_create_token.py b/rest_framework/authtoken/management/commands/drf_create_token.py index 417bdd780..da10bfc90 100644 --- a/rest_framework/authtoken/management/commands/drf_create_token.py +++ b/rest_framework/authtoken/management/commands/drf_create_token.py @@ -19,7 +19,7 @@ class Command(BaseCommand): return token[0] def add_arguments(self, parser): - parser.add_argument('username', type=str, nargs='+') + parser.add_argument('username', type=str) parser.add_argument( '-r', diff --git a/tests/test_authtoken.py b/tests/test_authtoken.py index 6374d7141..5df053da3 100644 --- a/tests/test_authtoken.py +++ b/tests/test_authtoken.py @@ -1,7 +1,9 @@ import pytest from django.contrib.admin import site from django.contrib.auth.models import User +from django.core.management import call_command from django.test import TestCase +from django.utils.six import StringIO from rest_framework.authtoken.admin import TokenAdmin from rest_framework.authtoken.management.commands.drf_create_token import \ @@ -68,3 +70,11 @@ class AuthTokenCommandTests(TestCase): second_token_key = Token.objects.first().key assert first_token_key == second_token_key + + def test_command_output(self): + out = StringIO() + call_command('drf_create_token', self.user.username, stdout=out) + token_saved = Token.objects.first() + self.assertIn('Generated token', out.getvalue()) + self.assertIn(self.user.username, out.getvalue()) + self.assertIn(token_saved.key, out.getvalue()) From 5ea810d5268d222e1582a9a33738b2a73f88c07b Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 14 Sep 2017 09:44:59 +0100 Subject: [PATCH 44/88] Drop unnecessary TODO notes. --- rest_framework/response.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/rest_framework/response.py b/rest_framework/response.py index cb0f290ce..bf0663255 100644 --- a/rest_framework/response.py +++ b/rest_framework/response.py @@ -88,8 +88,6 @@ class Response(SimpleTemplateResponse): Returns reason text corresponding to our HTTP response status code. Provided for convenience. """ - # TODO: Deprecate and use a template tag instead - # TODO: Status code text for RFC 6585 status codes return responses.get(self.status_code, '') def __getstate__(self): From d54df8c438d224616a8bcd745589b65e16db0989 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Thu, 14 Sep 2017 10:46:34 +0200 Subject: [PATCH 45/88] Refactor schema generation to allow per-view customisation (#5354) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial Refactor Step * Add descriptor class * call from generator * proxy back to generator for implementation. * Move `get_link` to descriptor * Move `get_description` to descriptor * Remove need for generator in get_description * Move get_path_fields to descriptor * Move `get_serializer_fields` to descriptor * Move `get_pagination_fields` to descriptor * Move `get_filter_fields` to descriptor * Move `get_encoding` to descriptor. * Pass just `url` from SchemaGenerator to descriptor * Make `view` a property Encapsulates check for a view instance. * Adjust API Reference docs * Add `ManualSchema` class * Refactor to `ViewInspector` plus `AutoSchema` The interface then is **just** `get_link()` * Add `manual_fields` kwarg to AutoSchema * Add schema decorator for FBVs * Adjust comments * Docs: Provide full params in example Ref feedback https://github.com/encode/django-rest-framework/pull/5354/files/b52e372f8f936204753b17fe7c9bfb517b93a045#r137254795 * Add docstring for ViewInstpector.__get__ descriptor method. Ref https://github.com/encode/django-rest-framework/pull/5354#discussion_r137265022 * Make `schemas` a package. * Split generators, inspectors, views. * Adjust imports * Rename to EndpointEnumerator * Adjust ManualSchema to take `fields` … and `description`. Allows `url` and `action` to remain dynamic * Add package/module docstrings --- docs/api-guide/schemas.md | 270 ++++++++++-- docs/api-guide/views.md | 22 + rest_framework/decorators.py | 10 + rest_framework/routers.py | 3 +- rest_framework/schemas/__init__.py | 43 ++ .../{schemas.py => schemas/generators.py} | 347 +-------------- rest_framework/schemas/inspectors.py | 399 ++++++++++++++++++ rest_framework/schemas/utils.py | 21 + rest_framework/schemas/views.py | 34 ++ rest_framework/views.py | 2 + tests/test_decorators.py | 17 +- tests/test_schemas.py | 83 +++- 12 files changed, 868 insertions(+), 383 deletions(-) create mode 100644 rest_framework/schemas/__init__.py rename rest_framework/{schemas.py => schemas/generators.py} (51%) create mode 100644 rest_framework/schemas/inspectors.py create mode 100644 rest_framework/schemas/utils.py create mode 100644 rest_framework/schemas/views.py diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index 836ad4b6a..f913f046f 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -10,7 +10,14 @@ API schemas are a useful tool that allow for a range of use cases, including generating reference documentation, or driving dynamic client libraries that can interact with your API. -## Representing schemas internally +## Install Core API + +You'll need to install the `coreapi` package in order to add schema support +for REST framework. + + pip install coreapi + +## Internal schema representation REST framework uses [Core API][coreapi] in order to model schema information in a format-independent representation. This information can then be rendered @@ -68,9 +75,34 @@ has to be rendered into the actual bytes that are used in the response. REST framework includes a renderer class for handling this media type, which is available as `renderers.CoreJSONRenderer`. +### Alternate schema formats + Other schema formats such as [Open API][open-api] ("Swagger"), -[JSON HyperSchema][json-hyperschema], or [API Blueprint][api-blueprint] can -also be supported by implementing a custom renderer class. +[JSON HyperSchema][json-hyperschema], or [API Blueprint][api-blueprint] can also +be supported by implementing a custom renderer class that handles converting a +`Document` instance into a bytestring representation. + +If there is a Core API codec package that supports encoding into the format you +want to use then implementing the renderer class can be done by using the codec. + +#### Example + +For example, the `openapi_codec` package provides support for encoding or decoding +to the Open API ("Swagger") format: + + from rest_framework import renderers + from openapi_codec import OpenAPICodec + + class SwaggerRenderer(renderers.BaseRenderer): + media_type = 'application/openapi+json' + format = 'swagger' + + def render(self, data, media_type=None, renderer_context=None): + codec = OpenAPICodec() + return codec.dump(data) + + + ## Schemas vs Hypermedia @@ -89,18 +121,121 @@ document, detailing both the current state and the available interactions. Further information and support on building Hypermedia APIs with REST framework is planned for a future version. + --- -# Adding a schema - -You'll need to install the `coreapi` package in order to add schema support -for REST framework. - - pip install coreapi +# Creating a schema REST framework includes functionality for auto-generating a schema, -or allows you to specify one explicitly. There are a few different ways to -add a schema to your API, depending on exactly what you need. +or allows you to specify one explicitly. + +## Manual Schema Specification + +To manually specify a schema you create a Core API `Document`, similar to the +example above. + + schema = coreapi.Document( + title='Flight Search API', + content={ + ... + } + ) + + +## Automatic Schema Generation + +Automatic schema generation is provided by the `SchemaGenerator` class. + +`SchemaGenerator` processes a list of routed URL pattterns and compiles the +appropriately structured Core API Document. + +Basic usage is just to provide the title for your schema and call +`get_schema()`: + + generator = schemas.SchemaGenerator(title='Flight Search API') + schema = generator.get_schema() + +### Per-View Schema Customisation + +By default, view introspection is performed by an `AutoSchema` instance +accessible via the `schema` attribute on `APIView`. This provides the +appropriate Core API `Link` object for the view, request method and path: + + auto_schema = view.schema + coreapi_link = auto_schema.get_link(...) + +(In compiling the schema, `SchemaGenerator` calls `view.schema.get_link()` for +each view, allowed method and path.) + +To customise the `Link` generation you may: + +* Instantiate `AutoSchema` on your view with the `manual_fields` kwarg: + + from rest_framework.views import APIView + from rest_framework.schemas import AutoSchema + + class CustomView(APIView): + ... + schema = AutoSchema( + manual_fields=[ + coreapi.Field("extra_field", ...), + ] + ) + + This allows extension for the most common case without subclassing. + +* Provide an `AutoSchema` subclass with more complex customisation: + + from rest_framework.views import APIView + from rest_framework.schemas import AutoSchema + + class CustomSchema(AutoSchema): + def get_link(...): + # Implemet custom introspection here (or in other sub-methods) + + class CustomView(APIView): + ... + schema = CustomSchema() + + This provides complete control over view introspection. + +* Instantiate `ManualSchema` on your view, providing the Core API `Fields` for + the view explicitly: + + from rest_framework.views import APIView + from rest_framework.schemas import ManualSchema + + class CustomView(APIView): + ... + schema = ManualSchema(fields=[ + coreapi.Field( + "first_field", + required=True, + location="path", + schema=coreschema.String() + ), + coreapi.Field( + "second_field", + required=True, + location="path", + schema=coreschema.String() + ), + ]) + + This allows manually specifying the schema for some views whilst maintaining + automatic generation elsewhere. + +--- + +**Note**: For full details on `SchemaGenerator` plus the `AutoSchema` and +`ManualSchema` descriptors see the [API Reference below](#api-reference). + +--- + +# Adding a schema view + +There are a few different ways to add a schema view to your API, depending on +exactly what you need. ## The get_schema_view shortcut @@ -342,38 +477,12 @@ A generic viewset with sections in the class docstring, using multi-line style. --- -# Alternate schema formats - -In order to support an alternate schema format, you need to implement a custom renderer -class that handles converting a `Document` instance into a bytestring representation. - -If there is a Core API codec package that supports encoding into the format you -want to use then implementing the renderer class can be done by using the codec. - -## Example - -For example, the `openapi_codec` package provides support for encoding or decoding -to the Open API ("Swagger") format: - - from rest_framework import renderers - from openapi_codec import OpenAPICodec - - class SwaggerRenderer(renderers.BaseRenderer): - media_type = 'application/openapi+json' - format = 'swagger' - - def render(self, data, media_type=None, renderer_context=None): - codec = OpenAPICodec() - return codec.dump(data) - ---- - # API Reference ## SchemaGenerator -A class that deals with introspecting your API views, which can be used to -generate a schema. +A class that walks a list of routed URL patterns, requests the schema for each view, +and collates the resulting CoreAPI Document. Typically you'll instantiate `SchemaGenerator` with a single argument, like so: @@ -406,39 +515,108 @@ Return a nested dictionary containing all the links that should be included in t This is a good point to override if you want to modify the resulting structure of the generated schema, as you can build a new dictionary with a different layout. -### get_link(self, path, method, view) + +## AutoSchema + +A class that deals with introspection of individual views for schema generation. + +`AutoSchema` is attached to `APIView` via the `schema` attribute. + +The `AutoSchema` constructor takes a single keyword argument `manual_fields`. + +**`manual_fields`**: a `list` of `coreapi.Field` instances that will be added to +the generated fields. Generated fields with a matching `name` will be overwritten. + + class CustomView(APIView): + schema = AutoSchema(manual_fields=[ + coreapi.Field( + "my_extra_field", + required=True, + location="path", + schema=coreschema.String() + ), + ]) + +For more advanced customisation subclass `AutoSchema` to customise schema generation. + + class CustomViewSchema(AutoSchema): + """ + Overrides `get_link()` to provide Custom Behavior X + """ + + def get_link(self, path, method, base_url): + link = super().get_link(path, method, base_url) + # Do something to customize link here... + return link + + class MyView(APIView): + schema = CustomViewSchema() + +The following methods are available to override. + +### get_link(self, path, method, base_url) Returns a `coreapi.Link` instance corresponding to the given view. +This is the main entry point. You can override this if you need to provide custom behaviors for particular views. -### get_description(self, path, method, view) +### get_description(self, path, method) Returns a string to use as the link description. By default this is based on the view docstring as described in the "Schemas as Documentation" section above. -### get_encoding(self, path, method, view) +### get_encoding(self, path, method) Returns a string to indicate the encoding for any request body, when interacting with the given view. Eg. `'application/json'`. May return a blank string for views that do not expect a request body. -### get_path_fields(self, path, method, view): +### get_path_fields(self, path, method): Return a list of `coreapi.Link()` instances. One for each path parameter in the URL. -### get_serializer_fields(self, path, method, view) +### get_serializer_fields(self, path, method) Return a list of `coreapi.Link()` instances. One for each field in the serializer class used by the view. -### get_pagination_fields(self, path, method, view +### get_pagination_fields(self, path, method) Return a list of `coreapi.Link()` instances, as returned by the `get_schema_fields()` method on any pagination class used by the view. -### get_filter_fields(self, path, method, view) +### get_filter_fields(self, path, method) Return a list of `coreapi.Link()` instances, as returned by the `get_schema_fields()` method of any filter classes used by the view. + +## ManualSchema + +Allows manually providing a list of `coreapi.Field` instances for the schema, +plus an optional description. + + class MyView(APIView): + schema = ManualSchema(fields=[ + coreapi.Field( + "first_field", + required=True, + location="path", + schema=coreschema.String() + ), + coreapi.Field( + "second_field", + required=True, + location="path", + schema=coreschema.String() + ), + ] + ) + +The `ManualSchema` constructor takes two arguments: + +**`fields`**: A list of `coreapi.Field` instances. Required. + +**`description`**: A string description. Optional. + --- ## Core API diff --git a/docs/api-guide/views.md b/docs/api-guide/views.md index 4fa36d0fc..24dd42578 100644 --- a/docs/api-guide/views.md +++ b/docs/api-guide/views.md @@ -184,6 +184,28 @@ The available decorators are: Each of these decorators takes a single argument which must be a list or tuple of classes. + +## View schema decorator + +To override the default schema generation for function based views you may use +the `@schema` decorator. This must come *after* (below) the `@api_view` +decorator. For example: + + from rest_framework.decorators import api_view, schema + from rest_framework.schemas import AutoSchema + + class CustomAutoSchema(AutoSchema): + def get_link(self, path, method, base_url): + # override view introspection here... + + @api_view(['GET']) + @schema(CustomAutoSchema()) + def view(request): + return Response({"message": "Hello for today! See you tomorrow!"}) + +This decorator takes a single `AutoSchema` instance, an `AutoSchema` subclass +instance or `ManualSchema` instance as described in the [Schemas documentation][schemas], + [cite]: http://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html [cite2]: http://www.boredomandlaziness.org/2012/05/djangos-cbvs-are-not-mistake-but.html [settings]: settings.md diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index bf9b32aaa..1297f96b4 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -72,6 +72,9 @@ def api_view(http_method_names=None, exclude_from_schema=False): WrappedAPIView.permission_classes = getattr(func, 'permission_classes', APIView.permission_classes) + WrappedAPIView.schema = getattr(func, 'schema', + APIView.schema) + WrappedAPIView.exclude_from_schema = exclude_from_schema return WrappedAPIView.as_view() return decorator @@ -112,6 +115,13 @@ def permission_classes(permission_classes): return decorator +def schema(view_inspector): + def decorator(func): + func.schema = view_inspector + return func + return decorator + + def detail_route(methods=None, **kwargs): """ Used to mark a method on a ViewSet that should be routed for detail requests. diff --git a/rest_framework/routers.py b/rest_framework/routers.py index a04bffc1a..01daa7e7d 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -26,7 +26,8 @@ from rest_framework import views from rest_framework.compat import NoReverseMatch from rest_framework.response import Response from rest_framework.reverse import reverse -from rest_framework.schemas import SchemaGenerator, SchemaView +from rest_framework.schemas import SchemaGenerator +from rest_framework.schemas.views import SchemaView from rest_framework.settings import api_settings from rest_framework.urlpatterns import format_suffix_patterns diff --git a/rest_framework/schemas/__init__.py b/rest_framework/schemas/__init__.py new file mode 100644 index 000000000..fc551640e --- /dev/null +++ b/rest_framework/schemas/__init__.py @@ -0,0 +1,43 @@ +""" +rest_framework.schemas + +schemas: + __init__.py + generators.py # Top-down schema generation + inspectors.py # Per-endpoint view introspection + utils.py # Shared helper functions + views.py # Houses `SchemaView`, `APIView` subclass. + +We expose a minimal "public" API directly from `schemas`. This covers the +basic use-cases: + + from rest_framework.schemas import ( + AutoSchema, + ManualSchema, + get_schema_view, + SchemaGenerator, + ) + +Other access should target the submodules directly +""" +from .generators import SchemaGenerator +from .inspectors import AutoSchema, ManualSchema # noqa + + +def get_schema_view( + title=None, url=None, description=None, urlconf=None, renderer_classes=None, + public=False, patterns=None, generator_class=SchemaGenerator): + """ + Return a schema view. + """ + # Avoid import cycle on APIView + from .views import SchemaView + generator = generator_class( + title=title, url=url, description=description, + urlconf=urlconf, patterns=patterns, + ) + return SchemaView.as_view( + renderer_classes=renderer_classes, + schema_generator=generator, + public=public, + ) diff --git a/rest_framework/schemas.py b/rest_framework/schemas/generators.py similarity index 51% rename from rest_framework/schemas.py rename to rest_framework/schemas/generators.py index 437413355..8344f64f0 100644 --- a/rest_framework/schemas.py +++ b/rest_framework/schemas/generators.py @@ -1,86 +1,26 @@ -import re +""" +generators.py # Top-down schema generation + +See schemas.__init__.py for package overview. +""" from collections import OrderedDict from importlib import import_module from django.conf import settings from django.contrib.admindocs.views import simplify_regex from django.core.exceptions import PermissionDenied -from django.db import models from django.http import Http404 from django.utils import six -from django.utils.encoding import force_text, smart_text -from django.utils.translation import ugettext_lazy as _ -from rest_framework import exceptions, renderers, serializers +from rest_framework import exceptions from rest_framework.compat import ( - RegexURLPattern, RegexURLResolver, coreapi, coreschema, uritemplate, - urlparse + RegexURLPattern, RegexURLResolver, coreapi, coreschema ) from rest_framework.request import clone_request -from rest_framework.response import Response from rest_framework.settings import api_settings -from rest_framework.utils import formatting from rest_framework.utils.model_meta import _get_pk -from rest_framework.views import APIView -header_regex = re.compile('^[a-zA-Z][0-9A-Za-z_]*:') - - -def field_to_schema(field): - title = force_text(field.label) if field.label else '' - description = force_text(field.help_text) if field.help_text else '' - - if isinstance(field, (serializers.ListSerializer, serializers.ListField)): - child_schema = field_to_schema(field.child) - return coreschema.Array( - items=child_schema, - title=title, - description=description - ) - elif isinstance(field, serializers.Serializer): - return coreschema.Object( - properties=OrderedDict([ - (key, field_to_schema(value)) - for key, value - in field.fields.items() - ]), - title=title, - description=description - ) - elif isinstance(field, serializers.ManyRelatedField): - return coreschema.Array( - items=coreschema.String(), - title=title, - description=description - ) - elif isinstance(field, serializers.RelatedField): - return coreschema.String(title=title, description=description) - elif isinstance(field, serializers.MultipleChoiceField): - return coreschema.Array( - items=coreschema.Enum(enum=list(field.choices.keys())), - title=title, - description=description - ) - elif isinstance(field, serializers.ChoiceField): - return coreschema.Enum( - enum=list(field.choices.keys()), - title=title, - description=description - ) - elif isinstance(field, serializers.BooleanField): - return coreschema.Boolean(title=title, description=description) - elif isinstance(field, (serializers.DecimalField, serializers.FloatField)): - return coreschema.Number(title=title, description=description) - elif isinstance(field, serializers.IntegerField): - return coreschema.Integer(title=title, description=description) - - if field.style.get('base_template') == 'textarea.html': - return coreschema.String( - title=title, - description=description, - format='textarea' - ) - return coreschema.String(title=title, description=description) +from .utils import is_list_view def common_path(paths): @@ -104,6 +44,8 @@ def is_api_view(callback): """ Return `True` if the given view callback is a REST framework view/viewset. """ + # Avoid import cycle on APIView + from rest_framework.views import APIView cls = getattr(callback, 'cls', None) return (cls is not None) and issubclass(cls, APIView) @@ -130,22 +72,6 @@ def is_custom_action(action): ]) -def is_list_view(path, method, view): - """ - Return True if the given path/method appears to represent a list view. - """ - if hasattr(view, 'action'): - # Viewsets have an explicitly defined action, which we can inspect. - return view.action == 'list' - - if method.lower() != 'get': - return False - path_components = path.strip('/').split('/') - if path_components and '{' in path_components[-1]: - return False - return True - - def endpoint_ordering(endpoint): path, method, callback = endpoint method_priority = { @@ -158,21 +84,7 @@ def endpoint_ordering(endpoint): return (path, method_priority) -def get_pk_description(model, model_field): - if isinstance(model_field, models.AutoField): - value_type = _('unique integer value') - elif isinstance(model_field, models.UUIDField): - value_type = _('UUID string') - else: - value_type = _('unique value') - - return _('A {value_type} identifying this {name}.').format( - value_type=value_type, - name=model._meta.verbose_name, - ) - - -class EndpointInspector(object): +class EndpointEnumerator(object): """ A class to determine the available API endpoints that a project exposes. """ @@ -265,7 +177,7 @@ class SchemaGenerator(object): 'patch': 'partial_update', 'delete': 'destroy', } - endpoint_inspector_cls = EndpointInspector + endpoint_inspector_cls = EndpointEnumerator # Map the method names we use for viewset actions onto external schema names. # These give us names that are more suitable for the external representation. @@ -341,7 +253,7 @@ class SchemaGenerator(object): for path, method, view in view_endpoints: if not self.has_view_permissions(path, method, view): continue - link = self.get_link(path, method, view) + link = view.schema.get_link(path, method, base_url=self.url) subpath = path[len(prefix):] keys = self.get_keys(subpath, method, view) insert_into(links, keys, link) @@ -433,197 +345,6 @@ class SchemaGenerator(object): field_name = 'id' return path.replace('{pk}', '{%s}' % field_name) - # Methods for generating each individual `Link` instance... - - def get_link(self, path, method, view): - """ - Return a `coreapi.Link` instance for the given endpoint. - """ - fields = self.get_path_fields(path, method, view) - fields += self.get_serializer_fields(path, method, view) - fields += self.get_pagination_fields(path, method, view) - fields += self.get_filter_fields(path, method, view) - - if fields and any([field.location in ('form', 'body') for field in fields]): - encoding = self.get_encoding(path, method, view) - else: - encoding = None - - description = self.get_description(path, method, view) - - if self.url and path.startswith('/'): - path = path[1:] - - return coreapi.Link( - url=urlparse.urljoin(self.url, path), - action=method.lower(), - encoding=encoding, - fields=fields, - description=description - ) - - def get_description(self, path, method, view): - """ - Determine a link description. - - This will be based on the method docstring if one exists, - or else the class docstring. - """ - method_name = getattr(view, 'action', method.lower()) - method_docstring = getattr(view, method_name, None).__doc__ - if method_docstring: - # An explicit docstring on the method or action. - return formatting.dedent(smart_text(method_docstring)) - - description = view.get_view_description() - lines = [line.strip() for line in description.splitlines()] - current_section = '' - sections = {'': ''} - - for line in lines: - if header_regex.match(line): - current_section, seperator, lead = line.partition(':') - sections[current_section] = lead.strip() - else: - sections[current_section] += '\n' + line - - header = getattr(view, 'action', method.lower()) - if header in sections: - return sections[header].strip() - if header in self.coerce_method_names: - if self.coerce_method_names[header] in sections: - return sections[self.coerce_method_names[header]].strip() - return sections[''].strip() - - def get_encoding(self, path, method, view): - """ - Return the 'encoding' parameter to use for a given endpoint. - """ - # Core API supports the following request encodings over HTTP... - supported_media_types = set(( - 'application/json', - 'application/x-www-form-urlencoded', - 'multipart/form-data', - )) - parser_classes = getattr(view, 'parser_classes', []) - for parser_class in parser_classes: - media_type = getattr(parser_class, 'media_type', None) - if media_type in supported_media_types: - return media_type - # Raw binary uploads are supported with "application/octet-stream" - if media_type == '*/*': - return 'application/octet-stream' - - return None - - def get_path_fields(self, path, method, view): - """ - Return a list of `coreapi.Field` instances corresponding to any - templated path variables. - """ - model = getattr(getattr(view, 'queryset', None), 'model', None) - fields = [] - - for variable in uritemplate.variables(path): - title = '' - description = '' - schema_cls = coreschema.String - kwargs = {} - if model is not None: - # Attempt to infer a field description if possible. - try: - model_field = model._meta.get_field(variable) - except: - model_field = None - - if model_field is not None and model_field.verbose_name: - title = force_text(model_field.verbose_name) - - if model_field is not None and model_field.help_text: - description = force_text(model_field.help_text) - elif model_field is not None and model_field.primary_key: - description = get_pk_description(model, model_field) - - if hasattr(view, 'lookup_value_regex') and view.lookup_field == variable: - kwargs['pattern'] = view.lookup_value_regex - elif isinstance(model_field, models.AutoField): - schema_cls = coreschema.Integer - - field = coreapi.Field( - name=variable, - location='path', - required=True, - schema=schema_cls(title=title, description=description, **kwargs) - ) - fields.append(field) - - return fields - - def get_serializer_fields(self, path, method, view): - """ - Return a list of `coreapi.Field` instances corresponding to any - request body input, as determined by the serializer class. - """ - if method not in ('PUT', 'PATCH', 'POST'): - return [] - - if not hasattr(view, 'get_serializer'): - return [] - - serializer = view.get_serializer() - - if isinstance(serializer, serializers.ListSerializer): - return [ - coreapi.Field( - name='data', - location='body', - required=True, - schema=coreschema.Array() - ) - ] - - if not isinstance(serializer, serializers.Serializer): - return [] - - fields = [] - for field in serializer.fields.values(): - if field.read_only or isinstance(field, serializers.HiddenField): - continue - - required = field.required and method != 'PATCH' - field = coreapi.Field( - name=field.field_name, - location='form', - required=required, - schema=field_to_schema(field) - ) - fields.append(field) - - return fields - - def get_pagination_fields(self, path, method, view): - if not is_list_view(path, method, view): - return [] - - pagination = getattr(view, 'pagination_class', None) - if not pagination: - return [] - - paginator = view.pagination_class() - return paginator.get_schema_fields(view) - - def get_filter_fields(self, path, method, view): - if not is_list_view(path, method, view): - return [] - - if not getattr(view, 'filter_backends', None): - return [] - - fields = [] - for filter_backend in view.filter_backends: - fields += filter_backend().get_schema_fields(view) - return fields - # Method for generating the link layout.... def get_keys(self, subpath, method, view): @@ -669,45 +390,3 @@ class SchemaGenerator(object): # Default action, eg "/users/", "/users/{pk}/" return named_path_components + [action] - - -class SchemaView(APIView): - _ignore_model_permissions = True - exclude_from_schema = True - renderer_classes = None - schema_generator = None - public = False - - def __init__(self, *args, **kwargs): - super(SchemaView, self).__init__(*args, **kwargs) - if self.renderer_classes is None: - if renderers.BrowsableAPIRenderer in api_settings.DEFAULT_RENDERER_CLASSES: - self.renderer_classes = [ - renderers.CoreJSONRenderer, - renderers.BrowsableAPIRenderer, - ] - else: - self.renderer_classes = [renderers.CoreJSONRenderer] - - def get(self, request, *args, **kwargs): - schema = self.schema_generator.get_schema(request, self.public) - if schema is None: - raise exceptions.PermissionDenied() - return Response(schema) - - -def get_schema_view( - title=None, url=None, description=None, urlconf=None, renderer_classes=None, - public=False, patterns=None, generator_class=SchemaGenerator): - """ - Return a schema view. - """ - generator = generator_class( - title=title, url=url, description=description, - urlconf=urlconf, patterns=patterns, - ) - return SchemaView.as_view( - renderer_classes=renderer_classes, - schema_generator=generator, - public=public, - ) diff --git a/rest_framework/schemas/inspectors.py b/rest_framework/schemas/inspectors.py new file mode 100644 index 000000000..cd9fa73da --- /dev/null +++ b/rest_framework/schemas/inspectors.py @@ -0,0 +1,399 @@ +""" +inspectors.py # Per-endpoint view introspection + +See schemas.__init__.py for package overview. +""" +import re +from collections import OrderedDict + +from django.db import models +from django.utils.encoding import force_text, smart_text +from django.utils.translation import ugettext_lazy as _ + +from rest_framework import serializers +from rest_framework.compat import coreapi, coreschema, uritemplate, urlparse +from rest_framework.settings import api_settings +from rest_framework.utils import formatting + +from .utils import is_list_view + +header_regex = re.compile('^[a-zA-Z][0-9A-Za-z_]*:') + + +def field_to_schema(field): + title = force_text(field.label) if field.label else '' + description = force_text(field.help_text) if field.help_text else '' + + if isinstance(field, (serializers.ListSerializer, serializers.ListField)): + child_schema = field_to_schema(field.child) + return coreschema.Array( + items=child_schema, + title=title, + description=description + ) + elif isinstance(field, serializers.Serializer): + return coreschema.Object( + properties=OrderedDict([ + (key, field_to_schema(value)) + for key, value + in field.fields.items() + ]), + title=title, + description=description + ) + elif isinstance(field, serializers.ManyRelatedField): + return coreschema.Array( + items=coreschema.String(), + title=title, + description=description + ) + elif isinstance(field, serializers.RelatedField): + return coreschema.String(title=title, description=description) + elif isinstance(field, serializers.MultipleChoiceField): + return coreschema.Array( + items=coreschema.Enum(enum=list(field.choices.keys())), + title=title, + description=description + ) + elif isinstance(field, serializers.ChoiceField): + return coreschema.Enum( + enum=list(field.choices.keys()), + title=title, + description=description + ) + elif isinstance(field, serializers.BooleanField): + return coreschema.Boolean(title=title, description=description) + elif isinstance(field, (serializers.DecimalField, serializers.FloatField)): + return coreschema.Number(title=title, description=description) + elif isinstance(field, serializers.IntegerField): + return coreschema.Integer(title=title, description=description) + + if field.style.get('base_template') == 'textarea.html': + return coreschema.String( + title=title, + description=description, + format='textarea' + ) + return coreschema.String(title=title, description=description) + + +def get_pk_description(model, model_field): + if isinstance(model_field, models.AutoField): + value_type = _('unique integer value') + elif isinstance(model_field, models.UUIDField): + value_type = _('UUID string') + else: + value_type = _('unique value') + + return _('A {value_type} identifying this {name}.').format( + value_type=value_type, + name=model._meta.verbose_name, + ) + + +class ViewInspector(object): + """ + Descriptor class on APIView. + + Provide subclass for per-view schema generation + """ + def __get__(self, instance, owner): + """ + Enables `ViewInspector` as a Python _Descriptor_. + + This is how `view.schema` knows about `view`. + + `__get__` is called when the descriptor is accessed on the owner. + (That will be when view.schema is called in our case.) + + `owner` is always the owner class. (An APIView, or subclass for us.) + `instance` is the view instance or `None` if accessed from the class, + rather than an instance. + + See: https://docs.python.org/3/howto/descriptor.html for info on + descriptor usage. + """ + self.view = instance + return self + + @property + def view(self): + """View property.""" + assert self._view is not None, "Schema generation REQUIRES a view instance. (Hint: you accessed `schema` from the view class rather than an instance.)" + return self._view + + @view.setter + def view(self, value): + self._view = value + + @view.deleter + def view(self): + self._view = None + + def get_link(self, path, method, base_url): + """ + Generate `coreapi.Link` for self.view, path and method. + + This is the main _public_ access point. + + Parameters: + + * path: Route path for view from URLConf. + * method: The HTTP request method. + * base_url: The project "mount point" as given to SchemaGenerator + """ + raise NotImplementedError(".get_link() must be overridden.") + + +class AutoSchema(ViewInspector): + """ + Default inspector for APIView + + Responsible for per-view instrospection and schema generation. + """ + def __init__(self, manual_fields=None): + """ + Parameters: + + * `manual_fields`: list of `coreapi.Field` instances that + will be added to auto-generated fields, overwriting on `Field.name` + """ + + self._manual_fields = manual_fields + + def get_link(self, path, method, base_url): + fields = self.get_path_fields(path, method) + fields += self.get_serializer_fields(path, method) + fields += self.get_pagination_fields(path, method) + fields += self.get_filter_fields(path, method) + + if self._manual_fields is not None: + by_name = {f.name: f for f in fields} + for f in self._manual_fields: + by_name[f.name] = f + fields = list(by_name.values()) + + if fields and any([field.location in ('form', 'body') for field in fields]): + encoding = self.get_encoding(path, method) + else: + encoding = None + + description = self.get_description(path, method) + + if base_url and path.startswith('/'): + path = path[1:] + + return coreapi.Link( + url=urlparse.urljoin(base_url, path), + action=method.lower(), + encoding=encoding, + fields=fields, + description=description + ) + + def get_description(self, path, method): + """ + Determine a link description. + + This will be based on the method docstring if one exists, + or else the class docstring. + """ + view = self.view + + method_name = getattr(view, 'action', method.lower()) + method_docstring = getattr(view, method_name, None).__doc__ + if method_docstring: + # An explicit docstring on the method or action. + return formatting.dedent(smart_text(method_docstring)) + + description = view.get_view_description() + lines = [line.strip() for line in description.splitlines()] + current_section = '' + sections = {'': ''} + + for line in lines: + if header_regex.match(line): + current_section, seperator, lead = line.partition(':') + sections[current_section] = lead.strip() + else: + sections[current_section] += '\n' + line + + # TODO: SCHEMA_COERCE_METHOD_NAMES appears here and in `SchemaGenerator.get_keys` + coerce_method_names = api_settings.SCHEMA_COERCE_METHOD_NAMES + header = getattr(view, 'action', method.lower()) + if header in sections: + return sections[header].strip() + if header in coerce_method_names: + if coerce_method_names[header] in sections: + return sections[coerce_method_names[header]].strip() + return sections[''].strip() + + def get_path_fields(self, path, method): + """ + Return a list of `coreapi.Field` instances corresponding to any + templated path variables. + """ + view = self.view + model = getattr(getattr(view, 'queryset', None), 'model', None) + fields = [] + + for variable in uritemplate.variables(path): + title = '' + description = '' + schema_cls = coreschema.String + kwargs = {} + if model is not None: + # Attempt to infer a field description if possible. + try: + model_field = model._meta.get_field(variable) + except: + model_field = None + + if model_field is not None and model_field.verbose_name: + title = force_text(model_field.verbose_name) + + if model_field is not None and model_field.help_text: + description = force_text(model_field.help_text) + elif model_field is not None and model_field.primary_key: + description = get_pk_description(model, model_field) + + if hasattr(view, 'lookup_value_regex') and view.lookup_field == variable: + kwargs['pattern'] = view.lookup_value_regex + elif isinstance(model_field, models.AutoField): + schema_cls = coreschema.Integer + + field = coreapi.Field( + name=variable, + location='path', + required=True, + schema=schema_cls(title=title, description=description, **kwargs) + ) + fields.append(field) + + return fields + + def get_serializer_fields(self, path, method): + """ + Return a list of `coreapi.Field` instances corresponding to any + request body input, as determined by the serializer class. + """ + view = self.view + + if method not in ('PUT', 'PATCH', 'POST'): + return [] + + if not hasattr(view, 'get_serializer'): + return [] + + serializer = view.get_serializer() + + if isinstance(serializer, serializers.ListSerializer): + return [ + coreapi.Field( + name='data', + location='body', + required=True, + schema=coreschema.Array() + ) + ] + + if not isinstance(serializer, serializers.Serializer): + return [] + + fields = [] + for field in serializer.fields.values(): + if field.read_only or isinstance(field, serializers.HiddenField): + continue + + required = field.required and method != 'PATCH' + field = coreapi.Field( + name=field.field_name, + location='form', + required=required, + schema=field_to_schema(field) + ) + fields.append(field) + + return fields + + def get_pagination_fields(self, path, method): + view = self.view + + if not is_list_view(path, method, view): + return [] + + pagination = getattr(view, 'pagination_class', None) + if not pagination: + return [] + + paginator = view.pagination_class() + return paginator.get_schema_fields(view) + + def get_filter_fields(self, path, method): + view = self.view + + if not is_list_view(path, method, view): + return [] + + if not getattr(view, 'filter_backends', None): + return [] + + fields = [] + for filter_backend in view.filter_backends: + fields += filter_backend().get_schema_fields(view) + return fields + + def get_encoding(self, path, method): + """ + Return the 'encoding' parameter to use for a given endpoint. + """ + view = self.view + + # Core API supports the following request encodings over HTTP... + supported_media_types = set(( + 'application/json', + 'application/x-www-form-urlencoded', + 'multipart/form-data', + )) + parser_classes = getattr(view, 'parser_classes', []) + for parser_class in parser_classes: + media_type = getattr(parser_class, 'media_type', None) + if media_type in supported_media_types: + return media_type + # Raw binary uploads are supported with "application/octet-stream" + if media_type == '*/*': + return 'application/octet-stream' + + return None + + +class ManualSchema(ViewInspector): + """ + Allows providing a list of coreapi.Fields, + plus an optional description. + """ + def __init__(self, fields, description=''): + """ + Parameters: + + * `fields`: list of `coreapi.Field` instances. + * `descripton`: String description for view. Optional. + """ + assert all(isinstance(f, coreapi.Field) for f in fields), "`fields` must be a list of coreapi.Field instances" + self._fields = fields + self._description = description + + def get_link(self, path, method, base_url): + + if base_url and path.startswith('/'): + path = path[1:] + + return coreapi.Link( + url=urlparse.urljoin(base_url, path), + action=method.lower(), + encoding=None, + fields=self._fields, + description=self._description + ) + + return self._link diff --git a/rest_framework/schemas/utils.py b/rest_framework/schemas/utils.py new file mode 100644 index 000000000..1542b6154 --- /dev/null +++ b/rest_framework/schemas/utils.py @@ -0,0 +1,21 @@ +""" +utils.py # Shared helper functions + +See schemas.__init__.py for package overview. +""" + + +def is_list_view(path, method, view): + """ + Return True if the given path/method appears to represent a list view. + """ + if hasattr(view, 'action'): + # Viewsets have an explicitly defined action, which we can inspect. + return view.action == 'list' + + if method.lower() != 'get': + return False + path_components = path.strip('/').split('/') + if path_components and '{' in path_components[-1]: + return False + return True diff --git a/rest_framework/schemas/views.py b/rest_framework/schemas/views.py new file mode 100644 index 000000000..932b5a487 --- /dev/null +++ b/rest_framework/schemas/views.py @@ -0,0 +1,34 @@ +""" +views.py # Houses `SchemaView`, `APIView` subclass. + +See schemas.__init__.py for package overview. +""" +from rest_framework import exceptions, renderers +from rest_framework.response import Response +from rest_framework.settings import api_settings +from rest_framework.views import APIView + + +class SchemaView(APIView): + _ignore_model_permissions = True + exclude_from_schema = True + renderer_classes = None + schema_generator = None + public = False + + def __init__(self, *args, **kwargs): + super(SchemaView, self).__init__(*args, **kwargs) + if self.renderer_classes is None: + if renderers.BrowsableAPIRenderer in api_settings.DEFAULT_RENDERER_CLASSES: + self.renderer_classes = [ + renderers.CoreJSONRenderer, + renderers.BrowsableAPIRenderer, + ] + else: + self.renderer_classes = [renderers.CoreJSONRenderer] + + def get(self, request, *args, **kwargs): + schema = self.schema_generator.get_schema(request, self.public) + if schema is None: + raise exceptions.PermissionDenied() + return Response(schema) diff --git a/rest_framework/views.py b/rest_framework/views.py index 8ec5f14ab..ccc2047ee 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -19,6 +19,7 @@ from rest_framework import exceptions, status from rest_framework.compat import set_rollback from rest_framework.request import Request from rest_framework.response import Response +from rest_framework.schemas import AutoSchema from rest_framework.settings import api_settings from rest_framework.utils import formatting @@ -113,6 +114,7 @@ class APIView(View): # Mark the view as being included or excluded from schema generation. exclude_from_schema = False + schema = AutoSchema() @classmethod def as_view(cls, **initkwargs): diff --git a/tests/test_decorators.py b/tests/test_decorators.py index b187e5fd6..6331742db 100644 --- a/tests/test_decorators.py +++ b/tests/test_decorators.py @@ -6,12 +6,13 @@ from rest_framework import status from rest_framework.authentication import BasicAuthentication from rest_framework.decorators import ( api_view, authentication_classes, parser_classes, permission_classes, - renderer_classes, throttle_classes + renderer_classes, schema, throttle_classes ) from rest_framework.parsers import JSONParser from rest_framework.permissions import IsAuthenticated from rest_framework.renderers import JSONRenderer from rest_framework.response import Response +from rest_framework.schemas import AutoSchema from rest_framework.test import APIRequestFactory from rest_framework.throttling import UserRateThrottle from rest_framework.views import APIView @@ -151,3 +152,17 @@ class DecoratorTestCase(TestCase): response = view(request) assert response.status_code == status.HTTP_429_TOO_MANY_REQUESTS + + def test_schema(self): + """ + Checks CustomSchema class is set on view + """ + class CustomSchema(AutoSchema): + pass + + @api_view(['GET']) + @schema(CustomSchema()) + def view(request): + return Response({}) + + assert isinstance(view.cls.schema, CustomSchema) diff --git a/tests/test_schemas.py b/tests/test_schemas.py index b435dfdd7..14ed0f6b6 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -1,5 +1,6 @@ import unittest +import pytest from django.conf.urls import include, url from django.core.exceptions import PermissionDenied from django.http import Http404 @@ -10,7 +11,9 @@ from rest_framework.compat import coreapi, coreschema from rest_framework.decorators import detail_route, list_route from rest_framework.request import Request from rest_framework.routers import DefaultRouter -from rest_framework.schemas import SchemaGenerator, get_schema_view +from rest_framework.schemas import ( + AutoSchema, ManualSchema, SchemaGenerator, get_schema_view +) from rest_framework.test import APIClient, APIRequestFactory from rest_framework.views import APIView from rest_framework.viewsets import ModelViewSet @@ -496,3 +499,81 @@ class Test4605Regression(TestCase): '/auth/convert-token/' ]) assert prefix == '/' + + +class TestDescriptor(TestCase): + + def test_apiview_schema_descriptor(self): + view = APIView() + assert hasattr(view, 'schema') + assert isinstance(view.schema, AutoSchema) + + def test_get_link_requires_instance(self): + descriptor = APIView.schema # Accessed from class + with pytest.raises(AssertionError): + descriptor.get_link(None, None, None) # ???: Do the dummy arguments require a tighter assert? + + def test_manual_fields(self): + + class CustomView(APIView): + schema = AutoSchema(manual_fields=[ + coreapi.Field( + "my_extra_field", + required=True, + location="path", + schema=coreschema.String() + ), + ]) + + view = CustomView() + link = view.schema.get_link('/a/url/{id}/', 'GET', '') + fields = link.fields + + assert len(fields) == 2 + assert "my_extra_field" in [f.name for f in fields] + + def test_view_with_manual_schema(self): + + path = '/example' + method = 'get' + base_url = None + + fields = [ + coreapi.Field( + "first_field", + required=True, + location="path", + schema=coreschema.String() + ), + coreapi.Field( + "second_field", + required=True, + location="path", + schema=coreschema.String() + ), + coreapi.Field( + "third_field", + required=True, + location="path", + schema=coreschema.String() + ), + ] + description = "A test endpoint" + + class CustomView(APIView): + """ + ManualSchema takes list of fields for endpoint. + - Provides url and action, which are always dynamic + """ + schema = ManualSchema(fields, description) + + expected = coreapi.Link( + url=path, + action=method, + fields=fields, + description=description + ) + + view = CustomView() + link = view.schema.get_link(path, method, base_url) + assert link == expected From efff9ff338bb0994b3249fa9907bb7018d7b6d5e Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Thu, 14 Sep 2017 13:20:41 +0200 Subject: [PATCH 46/88] 5378 fix schema generation markdown (#5421) * Test case for #5240 * Remove unnecessary strip() from get_description Closes #5240 * Adjust test case --- rest_framework/schemas/inspectors.py | 2 +- tests/test_schemas.py | 36 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/rest_framework/schemas/inspectors.py b/rest_framework/schemas/inspectors.py index cd9fa73da..a91205cde 100644 --- a/rest_framework/schemas/inspectors.py +++ b/rest_framework/schemas/inspectors.py @@ -207,7 +207,7 @@ class AutoSchema(ViewInspector): return formatting.dedent(smart_text(method_docstring)) description = view.get_view_description() - lines = [line.strip() for line in description.splitlines()] + lines = [line for line in description.splitlines()] current_section = '' sections = {'': ''} diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 14ed0f6b6..f8a63aa89 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -15,6 +15,7 @@ from rest_framework.schemas import ( AutoSchema, ManualSchema, SchemaGenerator, get_schema_view ) from rest_framework.test import APIClient, APIRequestFactory +from rest_framework.utils import formatting from rest_framework.views import APIView from rest_framework.viewsets import ModelViewSet @@ -577,3 +578,38 @@ class TestDescriptor(TestCase): view = CustomView() link = view.schema.get_link(path, method, base_url) assert link == expected + + +def test_docstring_is_not_stripped_by_get_description(): + class ExampleDocstringAPIView(APIView): + """ + === title + + * item a + * item a-a + * item a-b + * item b + + - item 1 + - item 2 + + code block begin + code + code + code + code block end + + the end + """ + + def get(self, *args, **kwargs): + pass + + def post(self, request, *args, **kwargs): + pass + + view = ExampleDocstringAPIView() + schema = view.schema + descr = schema.get_description('example', 'get') + # the first and last character are '\n' correctly removed by get_description + assert descr == formatting.dedent(ExampleDocstringAPIView.__doc__[1:][:-1]) From 7b1582e00e91001ec07cd394520ec5cdd2c2add1 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 20 Sep 2017 11:29:47 +0200 Subject: [PATCH 47/88] Allow `schema = None`. Deprecate `exclude_from_schema` (#5422) * Add tests for schema exclusions * Move exclusion check to should_include_endpoint * Update docs * Switch to using `schema = None` * Test PendingDeprecationWarnings * Add note to release notes. * s/deprecated/pending deprecation/ * Add PR link to release notes * Correct typo in test class name * Test 'exclude_from_schema' deprecation warning message (#1) * Correct deprecation warning message --- docs/api-guide/schemas.md | 6 ++ docs/api-guide/views.md | 17 +++-- docs/topics/release-notes.md | 3 + rest_framework/decorators.py | 10 ++- rest_framework/routers.py | 2 +- rest_framework/schemas/generators.py | 14 +++- rest_framework/schemas/views.py | 2 +- rest_framework/views.py | 2 - tests/test_schemas.py | 109 ++++++++++++++++++++++++++- 9 files changed, 149 insertions(+), 16 deletions(-) diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index f913f046f..fc848199c 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -225,6 +225,12 @@ To customise the `Link` generation you may: This allows manually specifying the schema for some views whilst maintaining automatic generation elsewhere. +You may disable schema generation for a view by setting `schema` to `None`: + + class CustomView(APIView): + ... + schema = None # Will not appear in schema + --- **Note**: For full details on `SchemaGenerator` plus the `AutoSchema` and diff --git a/docs/api-guide/views.md b/docs/api-guide/views.md index 24dd42578..2f9f51cf9 100644 --- a/docs/api-guide/views.md +++ b/docs/api-guide/views.md @@ -130,7 +130,7 @@ REST framework also allows you to work with regular function based views. It pr ## @api_view() -**Signature:** `@api_view(http_method_names=['GET'], exclude_from_schema=False)` +**Signature:** `@api_view(http_method_names=['GET'])` The core of this functionality is the `api_view` decorator, which takes a list of HTTP methods that your view should respond to. For example, this is how you would write a very simple view that just manually returns some data: @@ -150,12 +150,6 @@ By default only `GET` methods will be accepted. Other methods will respond with return Response({"message": "Got some data!", "data": request.data}) return Response({"message": "Hello, world!"}) -You can also mark an API view as being omitted from any [auto-generated schema][schemas], -using the `exclude_from_schema` argument.: - - @api_view(['GET'], exclude_from_schema=True) - def api_docs(request): - ... ## API policy decorators @@ -204,7 +198,14 @@ decorator. For example: return Response({"message": "Hello for today! See you tomorrow!"}) This decorator takes a single `AutoSchema` instance, an `AutoSchema` subclass -instance or `ManualSchema` instance as described in the [Schemas documentation][schemas], +instance or `ManualSchema` instance as described in the [Schemas documentation][schemas]. +You may pass `None` in order to exclude the view from schema generation. + + @api_view(['GET']) + @schema(None) + def view(request): + return Response({"message": "Will not appear in schema!"}) + [cite]: http://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html [cite2]: http://www.boredomandlaziness.org/2012/05/djangos-cbvs-are-not-mistake-but.html diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index f4617ac23..b9fff2ce0 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -43,6 +43,8 @@ You can determine your currently installed version using `pip freeze`: ### 3.6.5 * Fix `DjangoModelPermissions` to ensure user authentication before calling the view's `get_queryset()` method. As a side effect, this changes the order of the HTTP method permissions and authentication checks, and 405 responses will only be returned when authenticated. If you want to replicate the old behavior, see the PR for details. [#5376][gh5376] +* Deprecated `exclude_from_schema` on `APIView` and `api_view` decorator. Set `schema = None` or `@schema(None)` as appropriate. [#5422][gh5422] + ### 3.6.4 @@ -1423,3 +1425,4 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh5376]: https://github.com/encode/django-rest-framework/issues/5376 +[gh5422]: https://github.com/encode/django-rest-framework/issues/5422 diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index 1297f96b4..cdbd59e99 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -9,6 +9,7 @@ used to annotate methods on viewsets that should be included by routers. from __future__ import unicode_literals import types +import warnings from django.utils import six @@ -75,7 +76,14 @@ def api_view(http_method_names=None, exclude_from_schema=False): WrappedAPIView.schema = getattr(func, 'schema', APIView.schema) - WrappedAPIView.exclude_from_schema = exclude_from_schema + if exclude_from_schema: + warnings.warn( + "The `exclude_from_schema` argument to `api_view` is pending deprecation. " + "Use the `schema` decorator instead, passing `None`.", + PendingDeprecationWarning + ) + WrappedAPIView.exclude_from_schema = exclude_from_schema + return WrappedAPIView.as_view() return decorator diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 01daa7e7d..3b5ef46d8 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -291,7 +291,7 @@ class APIRootView(views.APIView): The default basic root view for DefaultRouter """ _ignore_model_permissions = True - exclude_from_schema = True + schema = None # exclude from schema api_root_dict = None def get(self, request, *args, **kwargs): diff --git a/rest_framework/schemas/generators.py b/rest_framework/schemas/generators.py index 8344f64f0..3e927527c 100644 --- a/rest_framework/schemas/generators.py +++ b/rest_framework/schemas/generators.py @@ -3,6 +3,7 @@ generators.py # Top-down schema generation See schemas.__init__.py for package overview. """ +import warnings from collections import OrderedDict from importlib import import_module @@ -148,6 +149,17 @@ class EndpointEnumerator(object): if not is_api_view(callback): return False # Ignore anything except REST framework views. + if hasattr(callback.cls, 'exclude_from_schema'): + fmt = ("The `{}.exclude_from_schema` attribute is pending deprecation. " + "Set `schema = None` instead.") + msg = fmt.format(callback.cls.__name__) + warnings.warn(msg, PendingDeprecationWarning) + if getattr(callback.cls, 'exclude_from_schema', False): + return False + + if callback.cls.schema is None: + return False + if path.endswith('.{format}') or path.endswith('.{format}/'): return False # Ignore .json style URLs. @@ -239,8 +251,6 @@ class SchemaGenerator(object): view_endpoints = [] for path, method, callback in self.endpoints: view = self.create_view(callback, method, request) - if getattr(view, 'exclude_from_schema', False): - continue path = self.coerce_path(path, method, view) paths.append(path) view_endpoints.append((path, method, view)) diff --git a/rest_framework/schemas/views.py b/rest_framework/schemas/views.py index 932b5a487..b13eadea9 100644 --- a/rest_framework/schemas/views.py +++ b/rest_framework/schemas/views.py @@ -11,7 +11,7 @@ from rest_framework.views import APIView class SchemaView(APIView): _ignore_model_permissions = True - exclude_from_schema = True + schema = None # exclude from schema renderer_classes = None schema_generator = None public = False diff --git a/rest_framework/views.py b/rest_framework/views.py index ccc2047ee..dfed15888 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -112,8 +112,6 @@ class APIView(View): # Allow dependency injection of other settings to make testing easier. settings = api_settings - # Mark the view as being included or excluded from schema generation. - exclude_from_schema = False schema = AutoSchema() @classmethod diff --git a/tests/test_schemas.py b/tests/test_schemas.py index f8a63aa89..184401a86 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -8,12 +8,15 @@ from django.test import TestCase, override_settings from rest_framework import filters, pagination, permissions, serializers from rest_framework.compat import coreapi, coreschema -from rest_framework.decorators import detail_route, list_route +from rest_framework.decorators import ( + api_view, detail_route, list_route, schema +) from rest_framework.request import Request from rest_framework.routers import DefaultRouter from rest_framework.schemas import ( AutoSchema, ManualSchema, SchemaGenerator, get_schema_view ) +from rest_framework.schemas.generators import EndpointEnumerator from rest_framework.test import APIClient, APIRequestFactory from rest_framework.utils import formatting from rest_framework.views import APIView @@ -613,3 +616,107 @@ def test_docstring_is_not_stripped_by_get_description(): descr = schema.get_description('example', 'get') # the first and last character are '\n' correctly removed by get_description assert descr == formatting.dedent(ExampleDocstringAPIView.__doc__[1:][:-1]) + + +# Views for SchemaGenerationExclusionTests +class ExcludedAPIView(APIView): + schema = None + + def get(self, request, *args, **kwargs): + pass + + +@api_view(['GET']) +@schema(None) +def excluded_fbv(request): + pass + + +@api_view(['GET']) +def included_fbv(request): + pass + + +@unittest.skipUnless(coreapi, 'coreapi is not installed') +class SchemaGenerationExclusionTests(TestCase): + def setUp(self): + self.patterns = [ + url('^excluded-cbv/$', ExcludedAPIView.as_view()), + url('^excluded-fbv/$', excluded_fbv), + url('^included-fbv/$', included_fbv), + ] + + def test_schema_generator_excludes_correctly(self): + """Schema should not include excluded views""" + generator = SchemaGenerator(title='Exclusions', patterns=self.patterns) + schema = generator.get_schema() + expected = coreapi.Document( + url='', + title='Exclusions', + content={ + 'included-fbv': { + 'list': coreapi.Link(url='/included-fbv/', action='get') + } + } + ) + + assert len(schema.data) == 1 + assert 'included-fbv' in schema.data + assert schema == expected + + def test_endpoint_enumerator_excludes_correctly(self): + """It is responsibility of EndpointEnumerator to exclude views""" + inspector = EndpointEnumerator(self.patterns) + endpoints = inspector.get_api_endpoints() + + assert len(endpoints) == 1 + path, method, callback = endpoints[0] + assert path == '/included-fbv/' + + def test_should_include_endpoint_excludes_correctly(self): + """This is the specific method that should handle the exclusion""" + inspector = EndpointEnumerator(self.patterns) + + # Not pretty. Mimics internals of EndpointEnumerator to put should_include_endpoint under test + pairs = [(inspector.get_path_from_regex(pattern.regex.pattern), pattern.callback) + for pattern in self.patterns] + + should_include = [ + inspector.should_include_endpoint(*pair) for pair in pairs + ] + + expected = [False, False, True] + + assert should_include == expected + + def test_deprecations(self): + with pytest.warns(PendingDeprecationWarning) as record: + @api_view(["GET"], exclude_from_schema=True) + def view(request): + pass + + assert len(record) == 1 + assert str(record[0].message) == ( + "The `exclude_from_schema` argument to `api_view` is pending " + "deprecation. Use the `schema` decorator instead, passing `None`." + ) + + class OldFashionedExcludedView(APIView): + exclude_from_schema = True + + def get(self, request, *args, **kwargs): + pass + + patterns = [ + url('^excluded-old-fashioned/$', OldFashionedExcludedView.as_view()), + ] + + inspector = EndpointEnumerator(patterns) + with pytest.warns(PendingDeprecationWarning) as record: + inspector.get_api_endpoints() + + assert len(record) == 1 + assert str(record[0].message) == ( + "The `OldFashionedExcludedView.exclude_from_schema` attribute is " + "pending deprecation. Set `schema = None` instead." + ) From c0a48622e150badb5440792d3e4b7cb3568a2147 Mon Sep 17 00:00:00 2001 From: Jeremy Nauta Date: Wed, 20 Sep 2017 03:33:50 -0600 Subject: [PATCH 48/88] Allow `ChoiceField.choices` to be set dynamically (#5426) ## Description The `choices` field for the `ChoiceField` class should be able to be edited after `ChoiceField.__init__` is called. ``` field = ChoiceField(choices=[1,2]) field.choices = [1] # Should no longer allow `2` as a choice ``` Currently, you must update `choices`, `grouped_choices`, and `choice_strings_to_values` to achieve this. This P/R keeps `grouped_choices` and `choice_strings_to_values` in sync whenever the `choices` are edited. --- rest_framework/fields.py | 26 +++++++++++++++++--------- tests/test_fields.py | 13 +++++++++++++ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index d2079d5d6..63df452ce 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -1337,18 +1337,10 @@ class ChoiceField(Field): html_cutoff_text = _('More than {count} items...') def __init__(self, choices, **kwargs): - self.grouped_choices = to_choices_dict(choices) - self.choices = flatten_choices_dict(self.grouped_choices) + self.choices = choices self.html_cutoff = kwargs.pop('html_cutoff', self.html_cutoff) self.html_cutoff_text = kwargs.pop('html_cutoff_text', self.html_cutoff_text) - # Map the string representation of choices to the underlying value. - # Allows us to deal with eg. integer choices while supporting either - # integer or string input, but still get the correct datatype out. - self.choice_strings_to_values = { - six.text_type(key): key for key in self.choices.keys() - } - self.allow_blank = kwargs.pop('allow_blank', False) super(ChoiceField, self).__init__(**kwargs) @@ -1377,6 +1369,22 @@ class ChoiceField(Field): cutoff_text=self.html_cutoff_text ) + def _get_choices(self): + return self._choices + + def _set_choices(self, choices): + self.grouped_choices = to_choices_dict(choices) + self._choices = flatten_choices_dict(self.grouped_choices) + + # Map the string representation of choices to the underlying value. + # Allows us to deal with eg. integer choices while supporting either + # integer or string input, but still get the correct datatype out. + self.choice_strings_to_values = { + six.text_type(key): key for key in self.choices.keys() + } + + choices = property(_get_choices, _set_choices) + class MultipleChoiceField(ChoiceField): default_error_messages = { diff --git a/tests/test_fields.py b/tests/test_fields.py index 4173e6ab5..011fbe7de 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -1425,6 +1425,19 @@ class TestChoiceField(FieldValues): assert items[9].value == 'boolean' + def test_edit_choices(self): + field = serializers.ChoiceField( + allow_null=True, + choices=[ + 1, 2, + ] + ) + field.choices = [1] + assert field.run_validation(1) is 1 + with pytest.raises(serializers.ValidationError) as exc_info: + field.run_validation(2) + assert exc_info.value.detail == ['"2" is not a valid choice.'] + class TestChoiceFieldWithType(FieldValues): """ From 89daaf6276805fbe9aef7524130b1a917da15366 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Wed, 20 Sep 2017 12:05:04 +0200 Subject: [PATCH 49/88] Add the project layout to the quickstart to have a milestone for the project creation. (#5434) --- docs/tutorial/quickstart.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md index e8a4c8ef6..31361413e 100644 --- a/docs/tutorial/quickstart.md +++ b/docs/tutorial/quickstart.md @@ -24,6 +24,30 @@ Create a new Django project named `tutorial`, then start a new app called `quick django-admin.py startapp quickstart cd .. +The project layout should look like: + + $ pwd + /tutorial + $ find . + . + ./manage.py + ./tutorial + ./tutorial/__init__.py + ./tutorial/quickstart + ./tutorial/quickstart/__init__.py + ./tutorial/quickstart/admin.py + ./tutorial/quickstart/apps.py + ./tutorial/quickstart/migrations + ./tutorial/quickstart/migrations/__init__.py + ./tutorial/quickstart/models.py + ./tutorial/quickstart/tests.py + ./tutorial/quickstart/views.py + ./tutorial/settings.py + ./tutorial/urls.py + ./tutorial/wsgi.py + +It may look unusual that the application has been created within the project directory. Using the project's namespace avoids name clashes with external module (topic goes outside the scope of the quickstart). + Now sync your database for the first time: python manage.py migrate From 7d6d043531845c8fdfbec7e62d1fe52ca04a0acf Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 20 Sep 2017 12:15:15 +0200 Subject: [PATCH 50/88] Fix DateTimeField TZ handling (#5435) * Add failing TZ tests for DateTimeField - tests "current" timezone activation - tests output for non-UTC timezones * Update DateTimeField TZ aware/naive test output * Fix DateTimeField TZ handling * Add Release Note for BC change --- docs/topics/release-notes.md | 7 +++ requirements/requirements-optionals.txt | 1 + rest_framework/fields.py | 7 ++- tests/test_fields.py | 60 +++++++++++++++++++++++-- 4 files changed, 70 insertions(+), 5 deletions(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index b9fff2ce0..5744771b3 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -44,7 +44,11 @@ You can determine your currently installed version using `pip freeze`: * Fix `DjangoModelPermissions` to ensure user authentication before calling the view's `get_queryset()` method. As a side effect, this changes the order of the HTTP method permissions and authentication checks, and 405 responses will only be returned when authenticated. If you want to replicate the old behavior, see the PR for details. [#5376][gh5376] * Deprecated `exclude_from_schema` on `APIView` and `api_view` decorator. Set `schema = None` or `@schema(None)` as appropriate. [#5422][gh5422] +* Timezone-aware `DateTimeField`s now respect active or default) `timezone` during serialization, instead of always using UTC. + Resolves inconsistency whereby instances were serialised with supplied datetime for `create` but UTC for `retrieve`. [#3732][gh3732] + + **Possible backwards compatibility break** if you were relying on datetime strings being UTC. Have client interpret datetimes or [set default or active timezone (docs)][djangodocs-set-timezone] to UTC if needed. ### 3.6.4 @@ -1426,3 +1430,6 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh5376]: https://github.com/encode/django-rest-framework/issues/5376 [gh5422]: https://github.com/encode/django-rest-framework/issues/5422 +[gh5408]: https://github.com/encode/django-rest-framework/issues/5408 +[gh3732]: https://github.com/encode/django-rest-framework/issues/3732 +[djangodocs-set-timezone]: https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/#default-time-zone-and-current-time-zone diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index e8ba50851..319b7547a 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -1,4 +1,5 @@ # Optional packages which may be used with REST framework. +pytz==2017.2 markdown==2.6.4 django-guardian==1.4.8 django-filter==1.0.4 diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 63df452ce..072bbf1b9 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -1125,7 +1125,9 @@ class DateTimeField(Field): """ field_timezone = getattr(self, 'timezone', self.default_timezone()) - if (field_timezone is not None) and not timezone.is_aware(value): + if field_timezone is not None: + if timezone.is_aware(value): + return value.astimezone(field_timezone) try: return timezone.make_aware(value, field_timezone) except InvalidTimeError: @@ -1135,7 +1137,7 @@ class DateTimeField(Field): return value def default_timezone(self): - return timezone.get_default_timezone() if settings.USE_TZ else None + return timezone.get_current_timezone() if settings.USE_TZ else None def to_internal_value(self, value): input_formats = getattr(self, 'input_formats', api_settings.DATETIME_INPUT_FORMATS) @@ -1174,6 +1176,7 @@ class DateTimeField(Field): return value if output_format.lower() == ISO_8601: + value = self.enforce_timezone(value) value = value.isoformat() if value.endswith('+00:00'): value = value[:-6] + 'Z' diff --git a/tests/test_fields.py b/tests/test_fields.py index 011fbe7de..c2b053189 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -10,12 +10,17 @@ import pytest from django.http import QueryDict from django.test import TestCase, override_settings from django.utils import six -from django.utils.timezone import utc +from django.utils.timezone import activate, deactivate, utc import rest_framework from rest_framework import compat, serializers from rest_framework.fields import is_simple_callable +try: + import pytz +except ImportError: + pytz = None + try: import typings except ImportError: @@ -1168,7 +1173,7 @@ class TestDateTimeField(FieldValues): datetime.date(2001, 1, 1): ['Expected a datetime but got a date.'], } outputs = { - datetime.datetime(2001, 1, 1, 13, 00): '2001-01-01T13:00:00', + datetime.datetime(2001, 1, 1, 13, 00): '2001-01-01T13:00:00Z', datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc): '2001-01-01T13:00:00Z', '2001-01-01T00:00:00': '2001-01-01T00:00:00', six.text_type('2016-01-10T00:00:00'): '2016-01-10T00:00:00', @@ -1230,10 +1235,59 @@ class TestNaiveDateTimeField(FieldValues): '2001-01-01 13:00': datetime.datetime(2001, 1, 1, 13, 00), } invalid_inputs = {} - outputs = {} + outputs = { + datetime.datetime(2001, 1, 1, 13, 00): '2001-01-01T13:00:00', + datetime.datetime(2001, 1, 1, 13, 00, tzinfo=utc): '2001-01-01T13:00:00', + } field = serializers.DateTimeField(default_timezone=None) +@pytest.mark.skipif(pytz is None, reason='pytz not installed') +class TestTZWithDateTimeField(FieldValues): + """ + Valid and invalid values for `DateTimeField` when not using UTC as the timezone. + """ + @classmethod + def setup_class(cls): + # use class setup method, as class-level attribute will still be evaluated even if test is skipped + kolkata = pytz.timezone('Asia/Kolkata') + + cls.valid_inputs = { + '2016-12-19T10:00:00': kolkata.localize(datetime.datetime(2016, 12, 19, 10)), + '2016-12-19T10:00:00+05:30': kolkata.localize(datetime.datetime(2016, 12, 19, 10)), + datetime.datetime(2016, 12, 19, 10): kolkata.localize(datetime.datetime(2016, 12, 19, 10)), + } + cls.invalid_inputs = {} + cls.outputs = { + datetime.datetime(2016, 12, 19, 10): '2016-12-19T10:00:00+05:30', + datetime.datetime(2016, 12, 19, 4, 30, tzinfo=utc): '2016-12-19T10:00:00+05:30', + } + cls.field = serializers.DateTimeField(default_timezone=kolkata) + + +@pytest.mark.skipif(pytz is None, reason='pytz not installed') +@override_settings(TIME_ZONE='UTC', USE_TZ=True) +class TestDefaultTZDateTimeField(TestCase): + """ + Test the current/default timezone handling in `DateTimeField`. + """ + + @classmethod + def setup_class(cls): + cls.field = serializers.DateTimeField() + cls.kolkata = pytz.timezone('Asia/Kolkata') + + def test_default_timezone(self): + assert self.field.default_timezone() == utc + + def test_current_timezone(self): + assert self.field.default_timezone() == utc + activate(self.kolkata) + assert self.field.default_timezone() == self.kolkata + deactivate() + assert self.field.default_timezone() == utc + + class TestNaiveDayLightSavingTimeTimeZoneDateTimeField(FieldValues): """ Invalid values for `DateTimeField` with datetime in DST shift (non-existing or ambiguous) and timezone with DST. From cb6e7e0fdd3fe621926014d0a4612fc923c78ade Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 20 Sep 2017 14:23:34 +0200 Subject: [PATCH 51/88] Drop erroneous `)` in release notes --- docs/topics/release-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 5744771b3..ef43df670 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -44,7 +44,7 @@ You can determine your currently installed version using `pip freeze`: * Fix `DjangoModelPermissions` to ensure user authentication before calling the view's `get_queryset()` method. As a side effect, this changes the order of the HTTP method permissions and authentication checks, and 405 responses will only be returned when authenticated. If you want to replicate the old behavior, see the PR for details. [#5376][gh5376] * Deprecated `exclude_from_schema` on `APIView` and `api_view` decorator. Set `schema = None` or `@schema(None)` as appropriate. [#5422][gh5422] -* Timezone-aware `DateTimeField`s now respect active or default) `timezone` during serialization, instead of always using UTC. +* Timezone-aware `DateTimeField`s now respect active or default `timezone` during serialization, instead of always using UTC. Resolves inconsistency whereby instances were serialised with supplied datetime for `create` but UTC for `retrieve`. [#3732][gh3732] From f6c19e5eacbdc8a132e996f66f019994f34fda70 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 14 Jul 2017 12:05:42 -0400 Subject: [PATCH 52/88] Remove DjangoFilterBackend and associated tests --- rest_framework/compat.py | 7 - rest_framework/filters.py | 41 +--- tests/models.py | 9 - tests/test_filters.py | 424 +------------------------------------- 4 files changed, 2 insertions(+), 479 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 168bccf83..528340d69 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -182,13 +182,6 @@ except ImportError: coreschema = None -# django-filter is optional -try: - import django_filters -except ImportError: - django_filters = None - - # django-crispy-forms is optional try: import crispy_forms diff --git a/rest_framework/filters.py b/rest_framework/filters.py index 63ebf05ef..0473787bb 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -5,7 +5,6 @@ returned by list views. from __future__ import unicode_literals import operator -import warnings from functools import reduce from django.core.exceptions import ImproperlyConfigured @@ -18,7 +17,7 @@ from django.utils.encoding import force_text from django.utils.translation import ugettext_lazy as _ from rest_framework.compat import ( - coreapi, coreschema, distinct, django_filters, guardian, template_render + coreapi, coreschema, distinct, guardian, template_render ) from rest_framework.settings import api_settings @@ -40,44 +39,6 @@ class BaseFilterBackend(object): return [] -if django_filters: - from django_filters.rest_framework.filterset import FilterSet as DFFilterSet - - class FilterSet(DFFilterSet): - def __init__(self, *args, **kwargs): - warnings.warn( - "The built in 'rest_framework.filters.FilterSet' is deprecated. " - "You should use 'django_filters.rest_framework.FilterSet' instead.", - DeprecationWarning, stacklevel=2 - ) - return super(FilterSet, self).__init__(*args, **kwargs) - - DFBase = django_filters.rest_framework.DjangoFilterBackend - -else: - def FilterSet(): - assert False, 'django-filter must be installed to use the `FilterSet` class' - - DFBase = BaseFilterBackend - - -class DjangoFilterBackend(DFBase): - """ - A filter backend that uses django-filter. - """ - def __new__(cls, *args, **kwargs): - assert django_filters, 'Using DjangoFilterBackend, but django-filter is not installed' - assert django_filters.VERSION >= (0, 15, 3), 'django-filter 0.15.3 and above is required' - - warnings.warn( - "The built in 'rest_framework.filters.DjangoFilterBackend' is deprecated. " - "You should use 'django_filters.rest_framework.DjangoFilterBackend' instead.", - DeprecationWarning, stacklevel=2 - ) - - return super(DjangoFilterBackend, cls).__new__(cls, *args, **kwargs) - - class SearchFilter(BaseFilterBackend): # The URL query parameter used for the search. search_param = api_settings.SEARCH_PARAM diff --git a/tests/models.py b/tests/models.py index 6c9dde8fa..e5d49a0a5 100644 --- a/tests/models.py +++ b/tests/models.py @@ -24,15 +24,6 @@ class BasicModel(RESTFrameworkModel): ) -class BaseFilterableItem(RESTFrameworkModel): - text = models.CharField(max_length=100) - - -class FilterableItem(BaseFilterableItem): - decimal = models.DecimalField(max_digits=4, decimal_places=2) - date = models.DateField() - - # Models for relations tests # ManyToMany class ManyToManyTarget(RESTFrameworkModel): diff --git a/tests/test_filters.py b/tests/test_filters.py index 6df0a3169..dc5b18068 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -2,125 +2,21 @@ from __future__ import unicode_literals import datetime import unittest -import warnings -from decimal import Decimal import django import pytest -from django.conf.urls import url from django.core.exceptions import ImproperlyConfigured from django.db import models from django.test import TestCase from django.test.utils import override_settings -from django.utils.dateparse import parse_date from django.utils.six.moves import reload_module -from rest_framework import filters, generics, serializers, status -from rest_framework.compat import django_filters, reverse +from rest_framework import filters, generics, serializers from rest_framework.test import APIRequestFactory -from .models import BaseFilterableItem, BasicModel, FilterableItem - factory = APIRequestFactory() -if django_filters: - class FilterableItemSerializer(serializers.ModelSerializer): - class Meta: - model = FilterableItem - fields = '__all__' - - # Basic filter on a list view. - class FilterFieldsRootView(generics.ListCreateAPIView): - queryset = FilterableItem.objects.all() - serializer_class = FilterableItemSerializer - filter_fields = ['decimal', 'date'] - filter_backends = (filters.DjangoFilterBackend,) - - # These class are used to test a filter class. - class SeveralFieldsFilter(django_filters.FilterSet): - text = django_filters.CharFilter(lookup_expr='icontains') - decimal = django_filters.NumberFilter(lookup_expr='lt') - date = django_filters.DateFilter(lookup_expr='gt') - - class Meta: - model = FilterableItem - fields = ['text', 'decimal', 'date'] - - class FilterClassRootView(generics.ListCreateAPIView): - queryset = FilterableItem.objects.all() - serializer_class = FilterableItemSerializer - filter_class = SeveralFieldsFilter - filter_backends = (filters.DjangoFilterBackend,) - - # These classes are used to test a misconfigured filter class. - class MisconfiguredFilter(django_filters.FilterSet): - text = django_filters.CharFilter(lookup_expr='icontains') - - class Meta: - model = BasicModel - fields = ['text'] - - class IncorrectlyConfiguredRootView(generics.ListCreateAPIView): - queryset = FilterableItem.objects.all() - serializer_class = FilterableItemSerializer - filter_class = MisconfiguredFilter - filter_backends = (filters.DjangoFilterBackend,) - - class FilterClassDetailView(generics.RetrieveAPIView): - queryset = FilterableItem.objects.all() - serializer_class = FilterableItemSerializer - filter_class = SeveralFieldsFilter - filter_backends = (filters.DjangoFilterBackend,) - - # These classes are used to test base model filter support - class BaseFilterableItemFilter(django_filters.FilterSet): - text = django_filters.CharFilter() - - class Meta: - model = BaseFilterableItem - fields = '__all__' - - # Test the same filter using the deprecated internal FilterSet class. - class BaseFilterableItemFilterWithProxy(filters.FilterSet): - text = django_filters.CharFilter() - - class Meta: - model = BaseFilterableItem - fields = '__all__' - - class BaseFilterableItemFilterRootView(generics.ListCreateAPIView): - queryset = FilterableItem.objects.all() - serializer_class = FilterableItemSerializer - filter_class = BaseFilterableItemFilter - filter_backends = (filters.DjangoFilterBackend,) - - class BaseFilterableItemFilterWithProxyRootView(BaseFilterableItemFilterRootView): - filter_class = BaseFilterableItemFilterWithProxy - - # Regression test for #814 - class FilterFieldsQuerysetView(generics.ListCreateAPIView): - queryset = FilterableItem.objects.all() - serializer_class = FilterableItemSerializer - filter_fields = ['decimal', 'date'] - filter_backends = (filters.DjangoFilterBackend,) - - class GetQuerysetView(generics.ListCreateAPIView): - serializer_class = FilterableItemSerializer - filter_class = SeveralFieldsFilter - filter_backends = (filters.DjangoFilterBackend,) - - def get_queryset(self): - return FilterableItem.objects.all() - - urlpatterns = [ - url(r'^(?P\d+)/$', FilterClassDetailView.as_view(), name='detail-view'), - url(r'^$', FilterClassRootView.as_view(), name='root-view'), - url(r'^get-queryset/$', GetQuerysetView.as_view(), - name='get-queryset-view'), - ] - - class BaseFilterTests(TestCase): def setUp(self): self.original_coreapi = filters.coreapi @@ -142,288 +38,6 @@ class BaseFilterTests(TestCase): assert self.filter_backend.get_schema_fields({}) == [] -class CommonFilteringTestCase(TestCase): - def _serialize_object(self, obj): - return {'id': obj.id, 'text': obj.text, 'decimal': str(obj.decimal), 'date': obj.date.isoformat()} - - def setUp(self): - """ - Create 10 FilterableItem instances. - """ - base_data = ('a', Decimal('0.25'), datetime.date(2012, 10, 8)) - for i in range(10): - text = chr(i + ord(base_data[0])) * 3 # Produces string 'aaa', 'bbb', etc. - decimal = base_data[1] + i - date = base_data[2] - datetime.timedelta(days=i * 2) - FilterableItem(text=text, decimal=decimal, date=date).save() - - self.objects = FilterableItem.objects - self.data = [ - self._serialize_object(obj) - for obj in self.objects.all() - ] - - -class IntegrationTestFiltering(CommonFilteringTestCase): - """ - Integration tests for filtered list views. - """ - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_backend_deprecation(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - view = FilterFieldsRootView.as_view() - request = factory.get('/') - response = view(request).render() - - assert response.status_code == status.HTTP_200_OK - assert response.data == self.data - - self.assertTrue(issubclass(w[-1].category, DeprecationWarning)) - self.assertIn("'rest_framework.filters.DjangoFilterBackend' is deprecated.", str(w[-1].message)) - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_no_df_deprecation(self): - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - - import django_filters.rest_framework - - class DFFilterFieldsRootView(FilterFieldsRootView): - filter_backends = (django_filters.rest_framework.DjangoFilterBackend,) - - view = DFFilterFieldsRootView.as_view() - request = factory.get('/') - response = view(request).render() - - assert response.status_code == status.HTTP_200_OK - assert response.data == self.data - assert len(w) == 0 - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_backend_mro(self): - class CustomBackend(filters.DjangoFilterBackend): - def filter_queryset(self, request, queryset, view): - assert False, "custom filter_queryset should run" - - class DFFilterFieldsRootView(FilterFieldsRootView): - filter_backends = (CustomBackend,) - - view = DFFilterFieldsRootView.as_view() - request = factory.get('/') - - with pytest.raises(AssertionError, message="custom filter_queryset should run"): - view(request).render() - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_get_filtered_fields_root_view(self): - """ - GET requests to paginated ListCreateAPIView should return paginated results. - """ - view = FilterFieldsRootView.as_view() - - # Basic test with no filter. - request = factory.get('/') - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - assert response.data == self.data - - # Tests that the decimal filter works. - search_decimal = Decimal('2.25') - request = factory.get('/', {'decimal': '%s' % search_decimal}) - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - expected_data = [f for f in self.data if Decimal(f['decimal']) == search_decimal] - assert response.data == expected_data - - # Tests that the date filter works. - search_date = datetime.date(2012, 9, 22) - request = factory.get('/', {'date': '%s' % search_date}) # search_date str: '2012-09-22' - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - expected_data = [f for f in self.data if parse_date(f['date']) == search_date] - assert response.data == expected_data - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_filter_with_queryset(self): - """ - Regression test for #814. - """ - view = FilterFieldsQuerysetView.as_view() - - # Tests that the decimal filter works. - search_decimal = Decimal('2.25') - request = factory.get('/', {'decimal': '%s' % search_decimal}) - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - expected_data = [f for f in self.data if Decimal(f['decimal']) == search_decimal] - assert response.data == expected_data - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_filter_with_get_queryset_only(self): - """ - Regression test for #834. - """ - view = GetQuerysetView.as_view() - request = factory.get('/get-queryset/') - view(request).render() - # Used to raise "issubclass() arg 2 must be a class or tuple of classes" - # here when neither `model' nor `queryset' was specified. - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_get_filtered_class_root_view(self): - """ - GET requests to filtered ListCreateAPIView that have a filter_class set - should return filtered results. - """ - view = FilterClassRootView.as_view() - - # Basic test with no filter. - request = factory.get('/') - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - assert response.data == self.data - - # Tests that the decimal filter set with 'lt' in the filter class works. - search_decimal = Decimal('4.25') - request = factory.get('/', {'decimal': '%s' % search_decimal}) - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - expected_data = [f for f in self.data if Decimal(f['decimal']) < search_decimal] - assert response.data == expected_data - - # Tests that the date filter set with 'gt' in the filter class works. - search_date = datetime.date(2012, 10, 2) - request = factory.get('/', {'date': '%s' % search_date}) # search_date str: '2012-10-02' - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - expected_data = [f for f in self.data if parse_date(f['date']) > search_date] - assert response.data == expected_data - - # Tests that the text filter set with 'icontains' in the filter class works. - search_text = 'ff' - request = factory.get('/', {'text': '%s' % search_text}) - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - expected_data = [f for f in self.data if search_text in f['text'].lower()] - assert response.data == expected_data - - # Tests that multiple filters works. - search_decimal = Decimal('5.25') - search_date = datetime.date(2012, 10, 2) - request = factory.get('/', { - 'decimal': '%s' % (search_decimal,), - 'date': '%s' % (search_date,) - }) - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - expected_data = [f for f in self.data if parse_date(f['date']) > search_date and - Decimal(f['decimal']) < search_decimal] - assert response.data == expected_data - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_incorrectly_configured_filter(self): - """ - An error should be displayed when the filter class is misconfigured. - """ - view = IncorrectlyConfiguredRootView.as_view() - - request = factory.get('/') - self.assertRaises(AssertionError, view, request) - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_base_model_filter(self): - """ - The `get_filter_class` model checks should allow base model filters. - """ - view = BaseFilterableItemFilterRootView.as_view() - - request = factory.get('/?text=aaa') - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - assert len(response.data) == 1 - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_base_model_filter_with_proxy(self): - """ - The `get_filter_class` model checks should allow base model filters. - """ - view = BaseFilterableItemFilterWithProxyRootView.as_view() - - request = factory.get('/?text=aaa') - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - assert len(response.data) == 1 - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_unknown_filter(self): - """ - GET requests with filters that aren't configured should return 200. - """ - view = FilterFieldsRootView.as_view() - - search_integer = 10 - request = factory.get('/', {'integer': '%s' % search_integer}) - response = view(request).render() - assert response.status_code == status.HTTP_200_OK - - -@override_settings(ROOT_URLCONF='tests.test_filters') -class IntegrationTestDetailFiltering(CommonFilteringTestCase): - """ - Integration tests for filtered detail views. - """ - def _get_url(self, item): - return reverse('detail-view', kwargs=dict(pk=item.pk)) - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_get_filtered_detail_view(self): - """ - GET requests to filtered RetrieveAPIView that have a filter_class set - should return filtered results. - """ - item = self.objects.all()[0] - data = self._serialize_object(item) - - # Basic test with no filter. - response = self.client.get(self._get_url(item)) - assert response.status_code == status.HTTP_200_OK - assert response.data == data - - # Tests that the decimal filter set that should fail. - search_decimal = Decimal('4.25') - high_item = self.objects.filter(decimal__gt=search_decimal)[0] - response = self.client.get( - '{url}'.format(url=self._get_url(high_item)), - {'decimal': '{param}'.format(param=search_decimal)}) - assert response.status_code == status.HTTP_404_NOT_FOUND - - # Tests that the decimal filter set that should succeed. - search_decimal = Decimal('4.25') - low_item = self.objects.filter(decimal__lt=search_decimal)[0] - low_item_data = self._serialize_object(low_item) - response = self.client.get( - '{url}'.format(url=self._get_url(low_item)), - {'decimal': '{param}'.format(param=search_decimal)}) - assert response.status_code == status.HTTP_200_OK - assert response.data == low_item_data - - # Tests that multiple filters works. - search_decimal = Decimal('5.25') - search_date = datetime.date(2012, 10, 2) - valid_item = self.objects.filter(decimal__lt=search_decimal, date__gt=search_date)[0] - valid_item_data = self._serialize_object(valid_item) - response = self.client.get( - '{url}'.format(url=self._get_url(valid_item)), { - 'decimal': '{decimal}'.format(decimal=search_decimal), - 'date': '{date}'.format(date=search_date) - }) - assert response.status_code == status.HTTP_200_OK - assert response.data == valid_item_data - - class SearchFilterModel(models.Model): title = models.CharField(max_length=20) text = models.CharField(max_length=100) @@ -720,42 +334,6 @@ class DjangoFilterOrderingSerializer(serializers.ModelSerializer): fields = '__all__' -class DjangoFilterOrderingTests(TestCase): - def setUp(self): - data = [{ - 'date': datetime.date(2012, 10, 8), - 'text': 'abc' - }, { - 'date': datetime.date(2013, 10, 8), - 'text': 'bcd' - }, { - 'date': datetime.date(2014, 10, 8), - 'text': 'cde' - }] - - for d in data: - DjangoFilterOrderingModel.objects.create(**d) - - @unittest.skipUnless(django_filters, 'django-filter not installed') - def test_default_ordering(self): - class DjangoFilterOrderingView(generics.ListAPIView): - serializer_class = DjangoFilterOrderingSerializer - queryset = DjangoFilterOrderingModel.objects.all() - filter_backends = (filters.DjangoFilterBackend,) - filter_fields = ['text'] - ordering = ('-date',) - - view = DjangoFilterOrderingView.as_view() - request = factory.get('/') - response = view(request) - - assert response.data == [ - {'id': 3, 'date': '2014-10-08', 'text': 'cde'}, - {'id': 2, 'date': '2013-10-08', 'text': 'bcd'}, - {'id': 1, 'date': '2012-10-08', 'text': 'abc'} - ] - - class OrderingFilterTests(TestCase): def setUp(self): # Sequence of title/text is: From b64f8066c06c3ad65e07e6741d8d7266d81ceba9 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 7 Jul 2017 12:46:17 -0400 Subject: [PATCH 53/88] Add json util wrapper, failing JSONField test --- rest_framework/utils/encoders.py | 2 +- rest_framework/utils/json.py | 33 ++++++++++++++++++++++++++++++++ tests/test_fields.py | 1 + tests/test_utils.py | 21 ++++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 rest_framework/utils/json.py diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index 8896e4f2c..a4fe8d0c4 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -1,7 +1,7 @@ """ Helper classes for parsers. """ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals import datetime import decimal diff --git a/rest_framework/utils/json.py b/rest_framework/utils/json.py new file mode 100644 index 000000000..cc7df542e --- /dev/null +++ b/rest_framework/utils/json.py @@ -0,0 +1,33 @@ + +from __future__ import absolute_import + +import functools +import json + + +def strict_constant(o): + raise ValueError('Out of range float values are not JSON compliant: ' + repr(o)) + + +@functools.wraps(json.dump) +def dump(*args, **kwargs): + kwargs.setdefault('allow_nan', False) + return json.dump(*args, **kwargs) + + +@functools.wraps(json.dumps) +def dumps(*args, **kwargs): + kwargs.setdefault('allow_nan', False) + return json.dumps(*args, **kwargs) + + +@functools.wraps(json.load) +def load(*args, **kwargs): + kwargs.setdefault('parse_constant', strict_constant) + return json.load(*args, **kwargs) + + +@functools.wraps(json.loads) +def loads(*args, **kwargs): + kwargs.setdefault('parse_constant', strict_constant) + return json.loads(*args, **kwargs) diff --git a/tests/test_fields.py b/tests/test_fields.py index c2b053189..c1b99818a 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -1896,6 +1896,7 @@ class TestJSONField(FieldValues): ] invalid_inputs = [ ({'a': set()}, ['Value must be valid JSON.']), + ({'a': float('inf')}, ['Value must be valid JSON.']), ] outputs = [ ({ diff --git a/tests/test_utils.py b/tests/test_utils.py index 11c9e9bb0..9619776d6 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -9,6 +9,7 @@ import rest_framework.utils.model_meta from rest_framework.compat import _resolve_model from rest_framework.routers import SimpleRouter from rest_framework.serializers import ModelSerializer +from rest_framework.utils import json from rest_framework.utils.breadcrumbs import get_breadcrumbs from rest_framework.views import APIView from rest_framework.viewsets import ModelViewSet @@ -177,3 +178,23 @@ class ResolveModelWithPatchedDjangoTests(TestCase): def test_blows_up_if_model_does_not_resolve(self): with self.assertRaises(ImproperlyConfigured): _resolve_model('tests.BasicModel') + + +class JsonFloatTests(TestCase): + """ + Internaly, wrapped json functions should adhere to strict float handling + """ + + def test_dumps(self): + with self.assertRaises(ValueError): + json.dumps(float('inf')) + + with self.assertRaises(ValueError): + json.dumps(float('nan')) + + def test_loads(self): + with self.assertRaises(ValueError): + json.loads("Infinity") + + with self.assertRaises(ValueError): + json.loads("NaN") From d740bae95a30d473e9de0019bc31475900caa435 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Fri, 7 Jul 2017 12:47:08 -0400 Subject: [PATCH 54/88] Update json imports --- rest_framework/fields.py | 3 +-- rest_framework/parsers.py | 2 +- rest_framework/renderers.py | 3 +-- rest_framework/utils/serializer_helpers.py | 2 +- tests/test_renderers.py | 2 +- tests/test_routers.py | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 072bbf1b9..e17a0bf9a 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -5,7 +5,6 @@ import copy import datetime import decimal import inspect -import json import re import uuid from collections import OrderedDict @@ -37,7 +36,7 @@ from rest_framework.compat import ( ) from rest_framework.exceptions import ErrorDetail, ValidationError from rest_framework.settings import api_settings -from rest_framework.utils import html, humanize_datetime, representation +from rest_framework.utils import html, humanize_datetime, json, representation class empty: diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py index 0e40e1a7a..5ebaeca2e 100644 --- a/rest_framework/parsers.py +++ b/rest_framework/parsers.py @@ -7,7 +7,6 @@ on the request, such as form content or json encoded data. from __future__ import unicode_literals import codecs -import json from django.conf import settings from django.core.files.uploadhandler import StopFutureHandlers @@ -23,6 +22,7 @@ from django.utils.six.moves.urllib import parse as urlparse from rest_framework import renderers from rest_framework.exceptions import ParseError +from rest_framework.utils import json class DataAndFiles(object): diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index 687cb0e1e..a87eb1889 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -9,7 +9,6 @@ REST framework also provides an HTML renderer that renders the browsable API. from __future__ import unicode_literals import base64 -import json from collections import OrderedDict from django import forms @@ -30,7 +29,7 @@ from rest_framework.compat import ( from rest_framework.exceptions import ParseError from rest_framework.request import is_form_media_type, override_method from rest_framework.settings import api_settings -from rest_framework.utils import encoders +from rest_framework.utils import encoders, json from rest_framework.utils.breadcrumbs import get_breadcrumbs from rest_framework.utils.field_mapping import ClassLookupDict diff --git a/rest_framework/utils/serializer_helpers.py b/rest_framework/utils/serializer_helpers.py index d1bba9666..da89d08ff 100644 --- a/rest_framework/utils/serializer_helpers.py +++ b/rest_framework/utils/serializer_helpers.py @@ -1,12 +1,12 @@ from __future__ import unicode_literals import collections -import json from collections import OrderedDict from django.utils.encoding import force_text from rest_framework.compat import unicode_to_repr +from rest_framework.utils import json class ReturnDict(OrderedDict): diff --git a/tests/test_renderers.py b/tests/test_renderers.py index 1625b0b70..ccc910c63 100644 --- a/tests/test_renderers.py +++ b/tests/test_renderers.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -import json import re from collections import MutableMapping, OrderedDict @@ -24,6 +23,7 @@ from rest_framework.request import Request from rest_framework.response import Response from rest_framework.settings import api_settings from rest_framework.test import APIRequestFactory +from rest_framework.utils import json from rest_framework.views import APIView DUMMYSTATUS = status.HTTP_200_OK diff --git a/tests/test_routers.py b/tests/test_routers.py index fee39b2b3..cbc7c0554 100644 --- a/tests/test_routers.py +++ b/tests/test_routers.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import json from collections import namedtuple import pytest @@ -15,6 +14,7 @@ from rest_framework.decorators import detail_route, list_route from rest_framework.response import Response from rest_framework.routers import DefaultRouter, SimpleRouter from rest_framework.test import APIRequestFactory +from rest_framework.utils import json factory = APIRequestFactory() From 8ab75a2f01df89ae14b21f44d3f76015e9191969 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 10 Jul 2017 15:23:12 -0400 Subject: [PATCH 55/88] Add 'STRICT_JSON' API setting. STRICT_JSON controls the renderer & parser behavior on whether or not to accept non-standard float values (NaN, Infinity). --- rest_framework/parsers.py | 5 ++++- rest_framework/renderers.py | 3 ++- rest_framework/settings.py | 1 + tests/test_parsers.py | 24 +++++++++++++++++++++--- tests/test_renderers.py | 13 +++++++++++++ tests/test_utils.py | 7 +++++++ 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py index 5ebaeca2e..7a256276a 100644 --- a/rest_framework/parsers.py +++ b/rest_framework/parsers.py @@ -22,6 +22,7 @@ from django.utils.six.moves.urllib import parse as urlparse from rest_framework import renderers from rest_framework.exceptions import ParseError +from rest_framework.settings import api_settings from rest_framework.utils import json @@ -53,6 +54,7 @@ class JSONParser(BaseParser): """ media_type = 'application/json' renderer_class = renderers.JSONRenderer + strict = api_settings.STRICT_JSON def parse(self, stream, media_type=None, parser_context=None): """ @@ -63,7 +65,8 @@ class JSONParser(BaseParser): try: decoded_stream = codecs.getreader(encoding)(stream) - return json.load(decoded_stream) + parse_constant = json.strict_constant if self.strict else None + return json.load(decoded_stream, parse_constant=parse_constant) except ValueError as exc: raise ParseError('JSON parse error - %s' % six.text_type(exc)) diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index a87eb1889..90f516b35 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -61,6 +61,7 @@ class JSONRenderer(BaseRenderer): encoder_class = encoders.JSONEncoder ensure_ascii = not api_settings.UNICODE_JSON compact = api_settings.COMPACT_JSON + strict = api_settings.STRICT_JSON # We don't set a charset because JSON is a binary encoding, # that can be encoded as utf-8, utf-16 or utf-32. @@ -101,7 +102,7 @@ class JSONRenderer(BaseRenderer): ret = json.dumps( data, cls=self.encoder_class, indent=indent, ensure_ascii=self.ensure_ascii, - separators=separators + allow_nan=not self.strict, separators=separators ) # On python 2.x json.dumps() returns bytestrings if ensure_ascii=True, diff --git a/rest_framework/settings.py b/rest_framework/settings.py index 3f3c9110a..bc42c38a6 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -110,6 +110,7 @@ DEFAULTS = { # Encoding 'UNICODE_JSON': True, 'COMPACT_JSON': True, + 'STRICT_JSON': True, 'COERCE_DECIMAL_TO_STRING': True, 'UPLOADED_FILES_USE_URL': True, diff --git a/tests/test_parsers.py b/tests/test_parsers.py index 2499bfa3a..0a18aad1a 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- - from __future__ import unicode_literals +import math + import pytest from django import forms from django.core.files.uploadhandler import ( @@ -9,7 +10,7 @@ from django.core.files.uploadhandler import ( ) from django.http.request import RawPostDataException from django.test import TestCase -from django.utils.six.moves import StringIO +from django.utils.six import BytesIO, StringIO from rest_framework.exceptions import ParseError from rest_framework.parsers import ( @@ -42,7 +43,6 @@ class TestFileUploadParser(TestCase): def setUp(self): class MockRequest(object): pass - from io import BytesIO self.stream = BytesIO( "Test text file".encode('utf-8') ) @@ -129,6 +129,24 @@ class TestFileUploadParser(TestCase): self.parser_context['request'].META['HTTP_CONTENT_DISPOSITION'] = disposition +class TestJSONParser(TestCase): + def bytes(self, value): + return BytesIO(value.encode('utf-8')) + + def test_float_strictness(self): + parser = JSONParser() + + # Default to strict + for value in ['Infinity', '-Infinity', 'NaN']: + with pytest.raises(ParseError): + parser.parse(self.bytes(value)) + + parser.strict = False + assert parser.parse(self.bytes('Infinity')) == float('inf') + assert parser.parse(self.bytes('-Infinity')) == float('-inf') + assert math.isnan(parser.parse(self.bytes('NaN'))) + + class TestPOSTAccessed(TestCase): def setUp(self): self.factory = APIRequestFactory() diff --git a/tests/test_renderers.py b/tests/test_renderers.py index ccc910c63..5f4aa51a3 100644 --- a/tests/test_renderers.py +++ b/tests/test_renderers.py @@ -358,6 +358,19 @@ class JSONRendererTests(TestCase): with self.assertRaises(TypeError): JSONRenderer().render(x) + def test_float_strictness(self): + renderer = JSONRenderer() + + # Default to strict + for value in [float('inf'), float('-inf'), float('nan')]: + with pytest.raises(ValueError): + renderer.render(value) + + renderer.strict = False + assert renderer.render(float('inf')) == b'Infinity' + assert renderer.render(float('-inf')) == b'-Infinity' + assert renderer.render(float('nan')) == b'NaN' + def test_without_content_type_args(self): """ Test basic JSON rendering. diff --git a/tests/test_utils.py b/tests/test_utils.py index 9619776d6..c5e6f26dc 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -198,3 +198,10 @@ class JsonFloatTests(TestCase): with self.assertRaises(ValueError): json.loads("NaN") + + +@override_settings(STRICT_JSON=False) +class NonStrictJsonFloatTests(JsonFloatTests): + """ + 'STRICT_JSON = False' should not somehow affect internal json behavior + """ From 901657e7e8fe460cf9f14b48b9bce70d3cd06b09 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 10 Jul 2017 17:22:55 -0400 Subject: [PATCH 56/88] Add banned imports to prevent standard json import --- requirements/requirements-codestyle.txt | 1 + rest_framework/utils/encoders.py | 2 +- rest_framework/utils/json.py | 2 +- setup.cfg | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/requirements/requirements-codestyle.txt b/requirements/requirements-codestyle.txt index 264416f5f..9bafbe391 100644 --- a/requirements/requirements-codestyle.txt +++ b/requirements/requirements-codestyle.txt @@ -1,5 +1,6 @@ # PEP8 code linting, which we run on all commits. flake8==2.4.0 +flake8-tidy-imports==1.1.0 pep8==1.5.7 # Sort and lint imports diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index a4fe8d0c4..d754e4465 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -5,7 +5,7 @@ from __future__ import absolute_import, unicode_literals import datetime import decimal -import json +import json # noqa import uuid from django.db.models.query import QuerySet diff --git a/rest_framework/utils/json.py b/rest_framework/utils/json.py index cc7df542e..ea5e22725 100644 --- a/rest_framework/utils/json.py +++ b/rest_framework/utils/json.py @@ -2,7 +2,7 @@ from __future__ import absolute_import import functools -import json +import json # noqa def strict_constant(o): diff --git a/setup.cfg b/setup.cfg index 509abd58b..9f6b5be77 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,3 +6,4 @@ license_file = LICENSE.md [flake8] ignore = E501 +banned-modules = json = use from rest_framework.utils import json! From c98223f2316984ac362ba06bc82d3e2ca454ede3 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 10 Jul 2017 18:51:44 -0400 Subject: [PATCH 57/88] Pass on invalid value (Inf, NaN) encoding in JSONBoundField --- rest_framework/utils/serializer_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/utils/serializer_helpers.py b/rest_framework/utils/serializer_helpers.py index da89d08ff..fa79b6526 100644 --- a/rest_framework/utils/serializer_helpers.py +++ b/rest_framework/utils/serializer_helpers.py @@ -88,7 +88,7 @@ class JSONBoundField(BoundField): value = self.value try: value = json.dumps(self.value, sort_keys=True, indent=4) - except TypeError: + except (TypeError, ValueError): pass return self.__class__(self._field, value, self.errors, self._prefix) From 215248c0421f451c2b6e64c45f511da7e60eae78 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 10 Jul 2017 19:34:04 -0400 Subject: [PATCH 58/88] Add 'STRICT_JSON' docs --- docs/api-guide/settings.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md index aaedd463e..5c9eaa12c 100644 --- a/docs/api-guide/settings.md +++ b/docs/api-guide/settings.md @@ -362,6 +362,14 @@ The default style is to return minified responses, in line with [Heroku's API de Default: `True` +#### STRICT_JSON + +When set to `True`, JSON rendering and parsing will only observe syntactically valid JSON, raising an exception for the extended float values (`nan`, `inf`, `-inf`) accepted by Python's `json` module. This is the recommended setting, as these values are not generally supported. e.g., neither Javascript's `JSON.Parse` nor PostgreSQL's JSON data type accept these values. + +When set to `False`, JSON rendering and parsing will be permissive. However, these values are still invalid and will need to be specially handled in your code. + +Default: `True` + #### COERCE_DECIMAL_TO_STRING When returning decimal objects in API representations that do not support a native decimal type, it is normally best to return the value as a string. This avoids the loss of precision that occurs with binary floating point implementations. From ea894cd90a7544b0507c5f94bb3eb3da25000ccf Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Tue, 11 Jul 2017 11:53:20 -0400 Subject: [PATCH 59/88] Add docstring to json wrapper module --- rest_framework/utils/json.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rest_framework/utils/json.py b/rest_framework/utils/json.py index ea5e22725..cb5572380 100644 --- a/rest_framework/utils/json.py +++ b/rest_framework/utils/json.py @@ -1,3 +1,10 @@ +""" +Wrapper for the builtin json module that ensures compliance with the JSON spec. + +REST framework should always import this wrapper module in order to maintain +spec-compliant encoding/decoding. Support for non-standard features should be +handled by users at the renderer and parser layer. +""" from __future__ import absolute_import From e29ad1e7b386f6a2f46b1e67560cdb93bdc050bf Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Fri, 22 Sep 2017 12:03:05 +0200 Subject: [PATCH 60/88] =?UTF-8?q?JSONEncoder:=20Don=E2=80=99t=20strip=20mi?= =?UTF-8?q?croseconds=20from=20`time`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4749. This is the matching commit to the fix for `datetime` in #4256 --- rest_framework/utils/encoders.py | 2 -- tests/test_encoders.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index d754e4465..87df365e0 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -37,8 +37,6 @@ class JSONEncoder(json.JSONEncoder): if timezone and timezone.is_aware(obj): raise ValueError("JSON can't represent timezone-aware times.") representation = obj.isoformat() - if obj.microsecond: - representation = representation[:12] return representation elif isinstance(obj, datetime.timedelta): return six.text_type(total_seconds(obj)) diff --git a/tests/test_encoders.py b/tests/test_encoders.py index 8f8694c47..27136df87 100644 --- a/tests/test_encoders.py +++ b/tests/test_encoders.py @@ -44,7 +44,7 @@ class JSONEncoderTests(TestCase): Tests encoding a timezone """ current_time = datetime.now().time() - assert self.encoder.default(current_time) == current_time.isoformat()[:12] + assert self.encoder.default(current_time) == current_time.isoformat() def test_encode_time_tz(self): """ From aecca9d8e83ed42cf6d4b04de84d82dd185e2aa7 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 25 Sep 2017 11:04:23 +0200 Subject: [PATCH 61/88] Add note on force_authenticate + refresh_from_db MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …in case you’re reusing the same in-memory user whilst updating it in the DB. Closes #5016, closes #5066, closes #4102 --- docs/api-guide/testing.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/api-guide/testing.md b/docs/api-guide/testing.md index 2b93080b3..caba5cea2 100644 --- a/docs/api-guide/testing.md +++ b/docs/api-guide/testing.md @@ -86,6 +86,10 @@ For example, when forcibly authenticating using a token, you might do something --- +**Note**: `force_authenticate` directly sets `request.user` to the in-memory `user` instance. If you are re-using the same `user` instance across multiple tests that update the saved `user` state, you may need to call [`refresh_from_db()`][refresh_from_db_docs] between tests. + +--- + **Note**: When using `APIRequestFactory`, the object that is returned is Django's standard `HttpRequest`, and not REST framework's `Request` object, which is only generated once the view is called. This means that setting attributes directly on the request object may not always have the effect you expect. For example, setting `.token` directly will have no effect, and setting `.user` directly will only work if session authentication is being used. @@ -378,3 +382,4 @@ For example, to add support for using `format='html'` in test requests, you migh [client]: https://docs.djangoproject.com/en/stable/topics/testing/tools/#the-test-client [requestfactory]: https://docs.djangoproject.com/en/stable/topics/testing/advanced/#django.test.client.RequestFactory [configuration]: #configuration +[refresh_from_db_docs]: https://docs.djangoproject.com/en/1.11/ref/models/instances/#django.db.models.Model.refresh_from_db From 60b9e58a1241a8821c7020555104b365cd97a1ec Mon Sep 17 00:00:00 2001 From: Kris Dorosz Date: Wed, 5 Jul 2017 10:35:17 +0200 Subject: [PATCH 62/88] Add support for page_size parameter in CursorPaginator class --- rest_framework/pagination.py | 34 +++++++- tests/test_pagination.py | 162 +++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+), 1 deletion(-) diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index 61e0a80b0..2c3b0d2a5 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -482,6 +482,15 @@ class CursorPagination(BasePagination): ordering = '-created' template = 'rest_framework/pagination/previous_and_next.html' + # Client can control the page size using this query parameter. + # Default is 'None'. Set to eg 'page_size' to enable usage. + page_size_query_param = None + page_size_query_description = _('Number of results to return per page.') + + # Set to an integer to limit the maximum page size the client may request. + # Only relevant if 'page_size_query_param' has also been set. + max_page_size = None + # The offset in the cursor is used in situations where we have a # nearly-unique index. (Eg millisecond precision creation timestamps) # We guard against malicious users attempting to cause expensive database @@ -566,6 +575,16 @@ class CursorPagination(BasePagination): return self.page def get_page_size(self, request): + if self.page_size_query_param: + try: + return _positive_int( + request.query_params[self.page_size_query_param], + strict=True, + cutoff=self.max_page_size + ) + except (KeyError, ValueError): + pass + return self.page_size def get_next_link(self): @@ -779,7 +798,7 @@ class CursorPagination(BasePagination): def get_schema_fields(self, view): assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`' assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`' - return [ + fields = [ coreapi.Field( name=self.cursor_query_param, required=False, @@ -790,3 +809,16 @@ class CursorPagination(BasePagination): ) ) ] + if self.page_size_query_param is not None: + fields.append( + coreapi.Field( + name=self.page_size_query_param, + required=False, + location='query', + schema=coreschema.Integer( + title='Page size', + description=force_text(self.page_size_query_description) + ) + ) + ) + return fields diff --git a/tests/test_pagination.py b/tests/test_pagination.py index dd7f70330..d9ad9e6f6 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -633,6 +633,164 @@ class CursorPaginationTestsMixin: assert isinstance(self.pagination.to_html(), type('')) + def test_cursor_pagination_with_page_size(self): + (previous, current, next, previous_url, next_url) = self.get_pages('/?page_size=20') + + assert previous is None + assert current == [1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7] + assert next == [7, 7, 7, 8, 9, 9, 9, 9, 9, 9] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + assert previous == [1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7] + assert current == [7, 7, 7, 8, 9, 9, 9, 9, 9, 9] + assert next is None + + def test_cursor_pagination_with_page_size_over_limit(self): + (previous, current, next, previous_url, next_url) = self.get_pages('/?page_size=30') + + assert previous is None + assert current == [1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7] + assert next == [7, 7, 7, 8, 9, 9, 9, 9, 9, 9] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + assert previous == [1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 5, 6, 7, 7, 7, 7, 7, 7] + assert current == [7, 7, 7, 8, 9, 9, 9, 9, 9, 9] + assert next is None + + def test_cursor_pagination_with_page_size_zero(self): + (previous, current, next, previous_url, next_url) = self.get_pages('/?page_size=0') + + assert previous is None + assert current == [1, 1, 1, 1, 1] + assert next == [1, 2, 3, 4, 4] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [1, 1, 1, 1, 1] + assert current == [1, 2, 3, 4, 4] + assert next == [4, 4, 5, 6, 7] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [1, 2, 3, 4, 4] + assert current == [4, 4, 5, 6, 7] + assert next == [7, 7, 7, 7, 7] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [4, 4, 4, 5, 6] # Paging artifact + assert current == [7, 7, 7, 7, 7] + assert next == [7, 7, 7, 8, 9] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [7, 7, 7, 7, 7] + assert current == [7, 7, 7, 8, 9] + assert next == [9, 9, 9, 9, 9] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [7, 7, 7, 8, 9] + assert current == [9, 9, 9, 9, 9] + assert next is None + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous == [7, 7, 7, 7, 7] + assert current == [7, 7, 7, 8, 9] + assert next == [9, 9, 9, 9, 9] + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous == [4, 4, 5, 6, 7] + assert current == [7, 7, 7, 7, 7] + assert next == [8, 9, 9, 9, 9] # Paging artifact + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous == [1, 2, 3, 4, 4] + assert current == [4, 4, 5, 6, 7] + assert next == [7, 7, 7, 7, 7] + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous == [1, 1, 1, 1, 1] + assert current == [1, 2, 3, 4, 4] + assert next == [4, 4, 5, 6, 7] + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous is None + assert current == [1, 1, 1, 1, 1] + assert next == [1, 2, 3, 4, 4] + + def test_cursor_pagination_with_page_size_negative(self): + (previous, current, next, previous_url, next_url) = self.get_pages('/?page_size=-5') + + assert previous is None + assert current == [1, 1, 1, 1, 1] + assert next == [1, 2, 3, 4, 4] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [1, 1, 1, 1, 1] + assert current == [1, 2, 3, 4, 4] + assert next == [4, 4, 5, 6, 7] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [1, 2, 3, 4, 4] + assert current == [4, 4, 5, 6, 7] + assert next == [7, 7, 7, 7, 7] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [4, 4, 4, 5, 6] # Paging artifact + assert current == [7, 7, 7, 7, 7] + assert next == [7, 7, 7, 8, 9] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [7, 7, 7, 7, 7] + assert current == [7, 7, 7, 8, 9] + assert next == [9, 9, 9, 9, 9] + + (previous, current, next, previous_url, next_url) = self.get_pages(next_url) + + assert previous == [7, 7, 7, 8, 9] + assert current == [9, 9, 9, 9, 9] + assert next is None + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous == [7, 7, 7, 7, 7] + assert current == [7, 7, 7, 8, 9] + assert next == [9, 9, 9, 9, 9] + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous == [4, 4, 5, 6, 7] + assert current == [7, 7, 7, 7, 7] + assert next == [8, 9, 9, 9, 9] # Paging artifact + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous == [1, 2, 3, 4, 4] + assert current == [4, 4, 5, 6, 7] + assert next == [7, 7, 7, 7, 7] + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous == [1, 1, 1, 1, 1] + assert current == [1, 2, 3, 4, 4] + assert next == [4, 4, 5, 6, 7] + + (previous, current, next, previous_url, next_url) = self.get_pages(previous_url) + + assert previous is None + assert current == [1, 1, 1, 1, 1] + assert next == [1, 2, 3, 4, 4] + class TestCursorPagination(CursorPaginationTestsMixin): """ @@ -671,6 +829,8 @@ class TestCursorPagination(CursorPaginationTestsMixin): class ExamplePagination(pagination.CursorPagination): page_size = 5 + page_size_query_param = 'page_size' + max_page_size = 20 ordering = 'created' self.pagination = ExamplePagination() @@ -727,6 +887,8 @@ class TestCursorPaginationWithValueQueryset(CursorPaginationTestsMixin, TestCase def setUp(self): class ExamplePagination(pagination.CursorPagination): page_size = 5 + page_size_query_param = 'page_size' + max_page_size = 20 ordering = 'created' self.pagination = ExamplePagination() From 11e585119691d851a6c206a38a07c6dafe8038a2 Mon Sep 17 00:00:00 2001 From: Paolo Melchiorre Date: Mon, 17 Jul 2017 12:02:30 +0200 Subject: [PATCH 63/88] Update pagination.md Fixed 2 missing spaces in Custom Pagination snippet --- docs/api-guide/pagination.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md index d767e45de..496886473 100644 --- a/docs/api-guide/pagination.md +++ b/docs/api-guide/pagination.md @@ -226,8 +226,8 @@ Suppose we want to replace the default pagination output style with a modified f def get_paginated_response(self, data): return Response({ 'links': { - 'next': self.get_next_link(), - 'previous': self.get_previous_link() + 'next': self.get_next_link(), + 'previous': self.get_previous_link() }, 'count': self.page.paginator.count, 'results': data From 107e8b3d23a933b8cdc1f14045d7d42742be53a9 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Mon, 25 Sep 2017 09:36:31 -0400 Subject: [PATCH 64/88] Make `DEFAULT_PAGINATION_CLASS` `None` by default. (#5170) * Changes to the paginator defaults and settings Require a default paginator be specified when using the page size setting. https://github.com/encode/django-rest-framework/issues/5168 * DRF-5168 import warnings missed this in last commit * Add a system checks file Add a check for pagination settings for the 3.7 upgrade cycle. * more compatible import approach * missing bactic * revised language and approach to import the system check Adds a rest framework app config. * Adjust doc wording --- docs/api-guide/pagination.md | 6 +++--- rest_framework/__init__.py | 2 ++ rest_framework/apps.py | 10 ++++++++++ rest_framework/checks.py | 18 ++++++++++++++++++ rest_framework/settings.py | 2 +- 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 rest_framework/apps.py create mode 100644 rest_framework/checks.py diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md index 496886473..7b5e5b3f6 100644 --- a/docs/api-guide/pagination.md +++ b/docs/api-guide/pagination.md @@ -21,14 +21,14 @@ Pagination can be turned off by setting the pagination class to `None`. ## Setting the pagination style -The default pagination style may be set globally, using the `DEFAULT_PAGINATION_CLASS` and `PAGE_SIZE` setting keys. For example, to use the built-in limit/offset pagination, you would do something like this: +The pagination style may be set globally, using the `DEFAULT_PAGINATION_CLASS` and `PAGE_SIZE` setting keys. For example, to use the built-in limit/offset pagination, you would do something like this: REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 100 } -Note that you need to set both the pagination class, and the page size that should be used. +Note that you need to set both the pagination class, and the page size that should be used. Both `DEFAULT_PAGINATION_CLASS` and `PAGE_SIZE` are `None` by default. You can also set the pagination class on an individual view by using the `pagination_class` attribute. Typically you'll want to use the same pagination style throughout your API, although you might want to vary individual aspects of the pagination, such as default or maximum page size, on a per-view basis. @@ -85,7 +85,7 @@ This pagination style accepts a single number page number in the request query p #### Setup -To enable the `PageNumberPagination` style globally, use the following configuration, modifying the `PAGE_SIZE` as desired: +To enable the `PageNumberPagination` style globally, use the following configuration, and set the `PAGE_SIZE` as desired: REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', diff --git a/rest_framework/__init__.py b/rest_framework/__init__.py index 9da9989e9..ae130a4d4 100644 --- a/rest_framework/__init__.py +++ b/rest_framework/__init__.py @@ -21,3 +21,5 @@ HTTP_HEADER_ENCODING = 'iso-8859-1' # Default datetime input and output formats ISO_8601 = 'iso-8601' + +default_app_config = 'rest_framework.apps.RestFrameworkConfig' diff --git a/rest_framework/apps.py b/rest_framework/apps.py new file mode 100644 index 000000000..f6013eb7e --- /dev/null +++ b/rest_framework/apps.py @@ -0,0 +1,10 @@ +from django.apps import AppConfig + + +class RestFrameworkConfig(AppConfig): + name = 'rest_framework' + verbose_name = "Django REST framework" + + def ready(self): + # Add System checks + from .checks import pagination_system_check # NOQA diff --git a/rest_framework/checks.py b/rest_framework/checks.py new file mode 100644 index 000000000..af6634d1e --- /dev/null +++ b/rest_framework/checks.py @@ -0,0 +1,18 @@ +from django.core.checks import Tags, Warning, register + + +@register(Tags.compatibility) +def pagination_system_check(app_configs, **kwargs): + errors = [] + # Use of default page size setting requires a default Paginator class + from rest_framework.settings import api_settings + if api_settings.PAGE_SIZE and not api_settings.DEFAULT_PAGINATION_CLASS: + errors.append( + Warning( + "You have specified a default PAGE_SIZE pagination rest_framework setting," + "without specifying also a DEFAULT_PAGINATION_CLASS.", + hint="The default for DEFAULT_PAGINATION_CLASS is None. " + "In previous versions this was PageNumberPagination", + ) + ) + return errors diff --git a/rest_framework/settings.py b/rest_framework/settings.py index bc42c38a6..86b577219 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -51,7 +51,7 @@ DEFAULTS = { 'DEFAULT_VERSIONING_CLASS': None, # Generic view behavior - 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', + 'DEFAULT_PAGINATION_CLASS': None, 'DEFAULT_FILTER_BACKENDS': (), # Throttling From 5333565fe668646b45cca86f0029e0ccd80555d9 Mon Sep 17 00:00:00 2001 From: Katharyn Garcia Date: Mon, 25 Sep 2017 16:17:25 +0200 Subject: [PATCH 65/88] allow custom authentication and permission classes for docs view --- rest_framework/documentation.py | 21 ++++++++++++++++++--- rest_framework/schemas/__init__.py | 8 +++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/rest_framework/documentation.py b/rest_framework/documentation.py index 48458e188..9f9c828bc 100644 --- a/rest_framework/documentation.py +++ b/rest_framework/documentation.py @@ -4,11 +4,14 @@ from rest_framework.renderers import ( CoreJSONRenderer, DocumentationRenderer, SchemaJSRenderer ) from rest_framework.schemas import SchemaGenerator, get_schema_view +from rest_framework.settings import api_settings def get_docs_view( title=None, description=None, schema_url=None, public=True, - patterns=None, generator_class=SchemaGenerator): + patterns=None, generator_class=SchemaGenerator, + authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, + permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES): renderer_classes = [DocumentationRenderer, CoreJSONRenderer] return get_schema_view( @@ -19,12 +22,16 @@ def get_docs_view( public=public, patterns=patterns, generator_class=generator_class, + authentication_classes=authentication_classes, + permission_classes=permission_classes, ) def get_schemajs_view( title=None, description=None, schema_url=None, public=True, - patterns=None, generator_class=SchemaGenerator): + patterns=None, generator_class=SchemaGenerator, + authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, + permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES): renderer_classes = [SchemaJSRenderer] return get_schema_view( @@ -35,12 +42,16 @@ def get_schemajs_view( public=public, patterns=patterns, generator_class=generator_class, + authentication_classes=authentication_classes, + permission_classes=permission_classes, ) def include_docs_urls( title=None, description=None, schema_url=None, public=True, - patterns=None, generator_class=SchemaGenerator): + patterns=None, generator_class=SchemaGenerator, + authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, + permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES): docs_view = get_docs_view( title=title, description=description, @@ -48,6 +59,8 @@ def include_docs_urls( public=public, patterns=patterns, generator_class=generator_class, + authentication_classes=authentication_classes, + permission_classes=permission_classes, ) schema_js_view = get_schemajs_view( title=title, @@ -56,6 +69,8 @@ def include_docs_urls( public=public, patterns=patterns, generator_class=generator_class, + authentication_classes=authentication_classes, + permission_classes=permission_classes, ) urls = [ url(r'^$', docs_view, name='docs-index'), diff --git a/rest_framework/schemas/__init__.py b/rest_framework/schemas/__init__.py index fc551640e..1af0b9fc5 100644 --- a/rest_framework/schemas/__init__.py +++ b/rest_framework/schemas/__init__.py @@ -20,13 +20,17 @@ basic use-cases: Other access should target the submodules directly """ +from rest_framework.settings import api_settings + from .generators import SchemaGenerator from .inspectors import AutoSchema, ManualSchema # noqa def get_schema_view( title=None, url=None, description=None, urlconf=None, renderer_classes=None, - public=False, patterns=None, generator_class=SchemaGenerator): + public=False, patterns=None, generator_class=SchemaGenerator, + authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES, + permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES): """ Return a schema view. """ @@ -40,4 +44,6 @@ def get_schema_view( renderer_classes=renderer_classes, schema_generator=generator, public=public, + authentication_classes=authentication_classes, + permission_classes=permission_classes, ) From 1bcee8c60c4429e1f841a32fcfe45a37f52fb0f8 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 25 Sep 2017 16:25:40 +0200 Subject: [PATCH 66/88] Document extra parameters to `get_schema_view` --- docs/api-guide/schemas.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index fc848199c..2cb29d5f8 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -334,6 +334,15 @@ to be exposed in the schema: May be used to specify a `SchemaGenerator` subclass to be passed to the `SchemaView`. +#### `authentication_classes` + +May be used to specify the list of authentication classes that will apply to the schema endpoint. +Defaults to `settings.DEFAULT_AUTHENTICATION_CLASSES` + +#### `permission_classes` + +May be used to specify the list of permission classes that will apply to the schema endpoint. +Defaults to `settings.DEFAULT_PERMISSION_CLASSES` ## Using an explicit schema view From bf0fbd5df174faf9e5399263c01d21e634470acf Mon Sep 17 00:00:00 2001 From: Sigve Sebastian Farstad Date: Mon, 25 Sep 2017 18:28:36 +0200 Subject: [PATCH 67/88] Catch APIException in doc generation (#5443) The documentation generator calls view.get_serializer() in order to inspect it for documentation generation. However, if get_serializer() throws an APIException (e.g. PermissionDenied), it doesn't get caught at the call site, but instead propagates up and aborts the entire view. With the try/except in this commit, the documentation generator instead gratiously ignores that particular view and moves on to the next one instead. Practical concequences of this commit is that the docs no longer break if any view's get_serializer(..) throws an APIException. --- rest_framework/schemas/inspectors.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rest_framework/schemas/inspectors.py b/rest_framework/schemas/inspectors.py index a91205cde..7f2c1cc71 100644 --- a/rest_framework/schemas/inspectors.py +++ b/rest_framework/schemas/inspectors.py @@ -4,13 +4,14 @@ inspectors.py # Per-endpoint view introspection See schemas.__init__.py for package overview. """ import re +import warnings from collections import OrderedDict from django.db import models from django.utils.encoding import force_text, smart_text from django.utils.translation import ugettext_lazy as _ -from rest_framework import serializers +from rest_framework import exceptions, serializers from rest_framework.compat import coreapi, coreschema, uritemplate, urlparse from rest_framework.settings import api_settings from rest_framework.utils import formatting @@ -285,7 +286,14 @@ class AutoSchema(ViewInspector): if not hasattr(view, 'get_serializer'): return [] - serializer = view.get_serializer() + try: + serializer = view.get_serializer() + except exceptions.APIException: + serializer = None + warnings.warn('{}.get_serializer() raised an exception during ' + 'schema generation. Serializer fields will not be ' + 'generated for {} {}.'.format( + type(view), method, path)) if isinstance(serializer, serializers.ListSerializer): return [ From 50acb9b2feb2fc3815e06cb881f81d3e16ff4864 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Mon, 25 Sep 2017 15:09:54 -0400 Subject: [PATCH 68/88] Fix warning in AutoSchema.get_serializer_fields() (#5451) --- rest_framework/schemas/inspectors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/schemas/inspectors.py b/rest_framework/schemas/inspectors.py index 7f2c1cc71..bdd720938 100644 --- a/rest_framework/schemas/inspectors.py +++ b/rest_framework/schemas/inspectors.py @@ -292,8 +292,8 @@ class AutoSchema(ViewInspector): serializer = None warnings.warn('{}.get_serializer() raised an exception during ' 'schema generation. Serializer fields will not be ' - 'generated for {} {}.'.format( - type(view), method, path)) + 'generated for {} {}.' + .format(view.__class__.__name__, method, path)) if isinstance(serializer, serializers.ListSerializer): return [ From 607e4edca77441f057ce40cd90175b1b5700f316 Mon Sep 17 00:00:00 2001 From: John Eskew Date: Tue, 26 Sep 2017 04:02:20 -0400 Subject: [PATCH 69/88] Defer translated string evaluation on validators. (#5452) * Customize validators to defer error string evaluation. * Add docstring for `CustomValidatorMessage` --- rest_framework/compat.py | 31 +++++++++++++++-- rest_framework/fields.py | 72 ++++++++++++++++++++++++++++------------ 2 files changed, 79 insertions(+), 24 deletions(-) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 528340d69..e0f718ced 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -11,13 +11,18 @@ import inspect import django from django.apps import apps from django.conf import settings -from django.core.exceptions import ImproperlyConfigured +from django.core.exceptions import ImproperlyConfigured, ValidationError +from django.core.validators import \ + MaxLengthValidator as DjangoMaxLengthValidator +from django.core.validators import MaxValueValidator as DjangoMaxValueValidator +from django.core.validators import \ + MinLengthValidator as DjangoMinLengthValidator +from django.core.validators import MinValueValidator as DjangoMinValueValidator from django.db import connection, models, transaction from django.template import Context, RequestContext, Template from django.utils import six from django.views.generic import View - try: from django.urls import ( NoReverseMatch, RegexURLPattern, RegexURLResolver, ResolverMatch, Resolver404, get_script_prefix, reverse, reverse_lazy, resolve @@ -293,6 +298,28 @@ try: except ImportError: DecimalValidator = None +class CustomValidatorMessage(object): + """ + We need to avoid evaluation of `lazy` translated `message` in `django.core.validators.BaseValidator.__init__`. + https://github.com/django/django/blob/75ed5900321d170debef4ac452b8b3cf8a1c2384/django/core/validators.py#L297 + + Ref: https://github.com/encode/django-rest-framework/pull/5452 + """ + def __init__(self, *args, **kwargs): + self.message = kwargs.pop('message', self.message) + super(CustomValidatorMessage, self).__init__(*args, **kwargs) + +class MinValueValidator(CustomValidatorMessage, DjangoMinValueValidator): + pass + +class MaxValueValidator(CustomValidatorMessage, DjangoMaxValueValidator): + pass + +class MinLengthValidator(CustomValidatorMessage, DjangoMinLengthValidator): + pass + +class MaxLengthValidator(CustomValidatorMessage, DjangoMaxLengthValidator): + pass def set_rollback(): if hasattr(transaction, 'set_rollback'): diff --git a/rest_framework/fields.py b/rest_framework/fields.py index e17a0bf9a..1bcdf763d 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -13,8 +13,7 @@ from django.conf import settings from django.core.exceptions import ValidationError as DjangoValidationError from django.core.exceptions import ObjectDoesNotExist from django.core.validators import ( - EmailValidator, MaxLengthValidator, MaxValueValidator, MinLengthValidator, - MinValueValidator, RegexValidator, URLValidator, ip_address_validators + EmailValidator, RegexValidator, URLValidator, ip_address_validators ) from django.forms import FilePathField as DjangoFilePathField from django.forms import ImageField as DjangoImageField @@ -25,14 +24,16 @@ from django.utils.dateparse import ( from django.utils.duration import duration_string from django.utils.encoding import is_protected_type, smart_text from django.utils.formats import localize_input, sanitize_separators +from django.utils.functional import lazy from django.utils.ipv6 import clean_ipv6_address from django.utils.timezone import utc from django.utils.translation import ugettext_lazy as _ from rest_framework import ISO_8601 from rest_framework.compat import ( - InvalidTimeError, get_remote_field, unicode_repr, unicode_to_repr, - value_from_object + InvalidTimeError, MaxLengthValidator, MaxValueValidator, + MinLengthValidator, MinValueValidator, get_remote_field, unicode_repr, + unicode_to_repr, value_from_object ) from rest_framework.exceptions import ErrorDetail, ValidationError from rest_framework.settings import api_settings @@ -750,11 +751,17 @@ class CharField(Field): self.min_length = kwargs.pop('min_length', None) super(CharField, self).__init__(**kwargs) if self.max_length is not None: - message = self.error_messages['max_length'].format(max_length=self.max_length) - self.validators.append(MaxLengthValidator(self.max_length, message=message)) + message = lazy( + self.error_messages['max_length'].format, + six.text_type)(max_length=self.max_length) + self.validators.append( + MaxLengthValidator(self.max_length, message=message)) if self.min_length is not None: - message = self.error_messages['min_length'].format(min_length=self.min_length) - self.validators.append(MinLengthValidator(self.min_length, message=message)) + message = lazy( + self.error_messages['min_length'].format, + six.text_type)(min_length=self.min_length) + self.validators.append( + MinLengthValidator(self.min_length, message=message)) def run_validation(self, data=empty): # Test for the empty string here so that it does not get validated, @@ -909,11 +916,17 @@ class IntegerField(Field): self.min_value = kwargs.pop('min_value', None) super(IntegerField, self).__init__(**kwargs) if self.max_value is not None: - message = self.error_messages['max_value'].format(max_value=self.max_value) - self.validators.append(MaxValueValidator(self.max_value, message=message)) + message = lazy( + self.error_messages['max_value'].format, + six.text_type)(max_value=self.max_value) + self.validators.append( + MaxValueValidator(self.max_value, message=message)) if self.min_value is not None: - message = self.error_messages['min_value'].format(min_value=self.min_value) - self.validators.append(MinValueValidator(self.min_value, message=message)) + message = lazy( + self.error_messages['min_value'].format, + six.text_type)(min_value=self.min_value) + self.validators.append( + MinValueValidator(self.min_value, message=message)) def to_internal_value(self, data): if isinstance(data, six.text_type) and len(data) > self.MAX_STRING_LENGTH: @@ -943,11 +956,17 @@ class FloatField(Field): self.min_value = kwargs.pop('min_value', None) super(FloatField, self).__init__(**kwargs) if self.max_value is not None: - message = self.error_messages['max_value'].format(max_value=self.max_value) - self.validators.append(MaxValueValidator(self.max_value, message=message)) + message = lazy( + self.error_messages['max_value'].format, + six.text_type)(max_value=self.max_value) + self.validators.append( + MaxValueValidator(self.max_value, message=message)) if self.min_value is not None: - message = self.error_messages['min_value'].format(min_value=self.min_value) - self.validators.append(MinValueValidator(self.min_value, message=message)) + message = lazy( + self.error_messages['min_value'].format, + six.text_type)(min_value=self.min_value) + self.validators.append( + MinValueValidator(self.min_value, message=message)) def to_internal_value(self, data): @@ -996,11 +1015,17 @@ class DecimalField(Field): super(DecimalField, self).__init__(**kwargs) if self.max_value is not None: - message = self.error_messages['max_value'].format(max_value=self.max_value) - self.validators.append(MaxValueValidator(self.max_value, message=message)) + message = lazy( + self.error_messages['max_value'].format, + six.text_type)(max_value=self.max_value) + self.validators.append( + MaxValueValidator(self.max_value, message=message)) if self.min_value is not None: - message = self.error_messages['min_value'].format(min_value=self.min_value) - self.validators.append(MinValueValidator(self.min_value, message=message)) + message = lazy( + self.error_messages['min_value'].format, + six.text_type)(min_value=self.min_value) + self.validators.append( + MinValueValidator(self.min_value, message=message)) def to_internal_value(self, data): """ @@ -1797,8 +1822,11 @@ class ModelField(Field): max_length = kwargs.pop('max_length', None) super(ModelField, self).__init__(**kwargs) if max_length is not None: - message = self.error_messages['max_length'].format(max_length=max_length) - self.validators.append(MaxLengthValidator(max_length, message=message)) + message = lazy( + self.error_messages['max_length'].format, + six.text_type)(max_length=self.max_length) + self.validators.append( + MaxLengthValidator(self.max_length, message=message)) def to_internal_value(self, data): rel = get_remote_field(self.model_field, default=None) From ab7e5c4551b828415db192ed8e1d8c272ae60d11 Mon Sep 17 00:00:00 2001 From: Rokker Ruslan Date: Tue, 26 Sep 2017 11:24:30 +0300 Subject: [PATCH 70/88] Added default value for 'detail' param into 'ValidationError' exception (#5342) --- rest_framework/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py index 7cc3ba049..12fd41931 100644 --- a/rest_framework/exceptions.py +++ b/rest_framework/exceptions.py @@ -123,7 +123,7 @@ class ValidationError(APIException): default_detail = _('Invalid input.') default_code = 'invalid' - def __init__(self, detail, code=None): + def __init__(self, detail=None, code=None): if detail is None: detail = self.default_detail if code is None: From b1c6ea124069c413e9d1ad5d38f8597df82ff0fb Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 27 Sep 2017 09:13:10 +0200 Subject: [PATCH 71/88] Adjust schema get_filter_fields rules to match framework (#5454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #5237 Generics/ModelViewset performs filtering on: list, retrieve, put, patch and destroy (plus method equivalents). i.e. on list plus anything that calls `get_object`. This PR makes schema generation follow that. It adds `AutoSchema._allows_filters()` which can be overridden in subclasses. I’ve made this initially “private” so we can make quick changes if needs be in a 3.7.1 etc. --- rest_framework/schemas/inspectors.py | 31 +++++++++++++++++++++------- tests/test_schemas.py | 18 ++++++++++------ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/rest_framework/schemas/inspectors.py b/rest_framework/schemas/inspectors.py index bdd720938..30f639f5b 100644 --- a/rest_framework/schemas/inspectors.py +++ b/rest_framework/schemas/inspectors.py @@ -337,18 +337,33 @@ class AutoSchema(ViewInspector): paginator = view.pagination_class() return paginator.get_schema_fields(view) + def _allows_filters(self, path, method): + """ + Determine whether to include filter Fields in schema. + + Default implementation looks for ModelViewSet or GenericAPIView + actions/methods that cause filtering on the default implementation. + + Override to adjust behaviour for your view. + + Note: Introduced in v3.7: Initially "private" (i.e. with leading underscore) + to allow changes based on user experience. + """ + if getattr(self.view, 'filter_backends', None) is None: + return False + + if hasattr(self.view, 'action'): + return self.view.action in ["list", "retrieve", "update", "partial_update", "destroy"] + + return method.lower in ["get", "put", "patch", "delete"] + def get_filter_fields(self, path, method): - view = self.view - - if not is_list_view(path, method, view): - return [] - - if not getattr(view, 'filter_backends', None): + if not self._allows_filters(path, method): return [] fields = [] - for filter_backend in view.filter_backends: - fields += filter_backend().get_schema_fields(view) + for filter_backend in self.view.filter_backends: + fields += filter_backend().get_schema_fields(self.view) return fields def get_encoding(self, path, method): diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 184401a86..07c49b71d 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -139,7 +139,8 @@ class TestRouterGeneratedSchema(TestCase): url='/example/{id}/', action='get', fields=[ - coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + coreapi.Field('id', required=True, location='path', schema=coreschema.String()), + coreapi.Field('ordering', required=False, location='query', schema=coreschema.String(title='Ordering', description='Which field to use when ordering the results.')) ] ) } @@ -179,7 +180,8 @@ class TestRouterGeneratedSchema(TestCase): url='/example/{id}/', action='get', fields=[ - coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + coreapi.Field('id', required=True, location='path', schema=coreschema.String()), + coreapi.Field('ordering', required=False, location='query', schema=coreschema.String(title='Ordering', description='Which field to use when ordering the results.')) ] ), 'custom_action': coreapi.Link( @@ -225,7 +227,8 @@ class TestRouterGeneratedSchema(TestCase): fields=[ coreapi.Field('id', required=True, location='path', schema=coreschema.String()), coreapi.Field('a', required=True, location='form', schema=coreschema.String(title='A', description=('A field description'))), - coreapi.Field('b', required=False, location='form', schema=coreschema.String(title='B')) + coreapi.Field('b', required=False, location='form', schema=coreschema.String(title='B')), + coreapi.Field('ordering', required=False, location='query', schema=coreschema.String(title='Ordering', description='Which field to use when ordering the results.')) ] ), 'partial_update': coreapi.Link( @@ -235,14 +238,16 @@ class TestRouterGeneratedSchema(TestCase): fields=[ coreapi.Field('id', required=True, location='path', schema=coreschema.String()), coreapi.Field('a', required=False, location='form', schema=coreschema.String(title='A', description='A field description')), - coreapi.Field('b', required=False, location='form', schema=coreschema.String(title='B')) + coreapi.Field('b', required=False, location='form', schema=coreschema.String(title='B')), + coreapi.Field('ordering', required=False, location='query', schema=coreschema.String(title='Ordering', description='Which field to use when ordering the results.')) ] ), 'delete': coreapi.Link( url='/example/{id}/', action='delete', fields=[ - coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + coreapi.Field('id', required=True, location='path', schema=coreschema.String()), + coreapi.Field('ordering', required=False, location='query', schema=coreschema.String(title='Ordering', description='Which field to use when ordering the results.')) ] ) } @@ -450,7 +455,8 @@ class TestSchemaGeneratorWithMethodLimitedViewSets(TestCase): url='/example1/{id}/', action='get', fields=[ - coreapi.Field('id', required=True, location='path', schema=coreschema.String()) + coreapi.Field('id', required=True, location='path', schema=coreschema.String()), + coreapi.Field('ordering', required=False, location='query', schema=coreschema.String(title='Ordering', description='Which field to use when ordering the results.')) ] ) } From 296904099f1f87657e064d5915737cbb59fde079 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 27 Sep 2017 10:29:48 +0200 Subject: [PATCH 72/88] Update test matrix: Add Django 2.0, drop 1.8 (#5457) * Add Django 2.0 to tox/travis. Updated requirements * Drop Django 1.8 & 1.9 --- .travis.yml | 10 ++++++---- requirements/requirements-codestyle.txt | 4 ++-- requirements/requirements-documentation.txt | 2 +- requirements/requirements-optionals.txt | 4 ++-- requirements/requirements-packaging.txt | 4 ++-- requirements/requirements-testing.txt | 4 ++-- tox.ini | 10 ++++------ 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7a91af809..6a3ce8c49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,9 @@ python: sudo: false env: - - DJANGO=1.8 - - DJANGO=1.9 - DJANGO=1.10 - DJANGO=1.11 + - DJANGO=2.0 - DJANGO=master matrix: @@ -21,8 +20,8 @@ matrix: env: DJANGO=master - python: "3.6" env: DJANGO=1.11 - - python: "3.3" - env: DJANGO=1.8 + - python: "3.6" + env: DJANGO=2.0 - python: "2.7" env: TOXENV="lint" - python: "2.7" @@ -30,11 +29,14 @@ matrix: exclude: - python: "2.7" env: DJANGO=master + - python: "2.7" + env: DJANGO=2.0 - python: "3.4" env: DJANGO=master allow_failures: - env: DJANGO=master + - env: DJANGO=2.0 install: - pip install tox tox-travis diff --git a/requirements/requirements-codestyle.txt b/requirements/requirements-codestyle.txt index 9bafbe391..a64cfa29f 100644 --- a/requirements/requirements-codestyle.txt +++ b/requirements/requirements-codestyle.txt @@ -1,7 +1,7 @@ # PEP8 code linting, which we run on all commits. -flake8==2.4.0 +flake8==3.4.1 flake8-tidy-imports==1.1.0 -pep8==1.5.7 +pep8==1.7.0 # Sort and lint imports isort==4.2.5 diff --git a/requirements/requirements-documentation.txt b/requirements/requirements-documentation.txt index 81aa70456..012ec99f1 100644 --- a/requirements/requirements-documentation.txt +++ b/requirements/requirements-documentation.txt @@ -1,2 +1,2 @@ # MkDocs to build our documentation. -mkdocs==0.16.2 +mkdocs==0.16.3 diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index 319b7547a..67525bebc 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -1,7 +1,7 @@ # Optional packages which may be used with REST framework. pytz==2017.2 markdown==2.6.4 -django-guardian==1.4.8 +django-guardian==1.4.9 django-filter==1.0.4 -coreapi==2.2.4 +coreapi==2.3.1 coreschema==0.0.4 diff --git a/requirements/requirements-packaging.txt b/requirements/requirements-packaging.txt index f930bfa96..f12d4af0e 100644 --- a/requirements/requirements-packaging.txt +++ b/requirements/requirements-packaging.txt @@ -1,8 +1,8 @@ # Wheel for PyPI installs. -wheel==0.29.0 +wheel==0.30.0 # Twine for secured PyPI uploads. -twine==1.6.5 +twine==1.9.1 # Transifex client for managing translation resources. transifex-client==0.11 diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt index b9e168442..515cff78d 100644 --- a/requirements/requirements-testing.txt +++ b/requirements/requirements-testing.txt @@ -1,4 +1,4 @@ # PyTest for running the tests. -pytest==3.0.5 +pytest==3.2.2 pytest-django==3.1.2 -pytest-cov==2.4.0 +pytest-cov==2.5.1 diff --git a/tox.ini b/tox.ini index 698a0b745..9c91a4920 100644 --- a/tox.ini +++ b/tox.ini @@ -3,18 +3,17 @@ addopts=--tb=short [tox] envlist = - {py27,py33,py34,py35}-django18, - {py27,py34,py35}-django{19,110}, + {py27,py34,py35}-django110, {py27,py34,py35,py36}-django111, + {py34,py35,py36}-django20, {py35,py36}-djangomaster lint,docs [travis:env] DJANGO = - 1.8: django18 - 1.9: django19 1.10: django110 1.11: django111 + 2.0: django20 master: djangomaster [testenv] @@ -23,10 +22,9 @@ setenv = PYTHONDONTWRITEBYTECODE=1 PYTHONWARNINGS=once deps = - django18: Django>=1.8,<1.9 - django19: Django>=1.9,<1.10 django110: Django>=1.10,<1.11 django111: Django>=1.11,<2.0 + django20: Django>=2.0a1,<2.1 djangomaster: https://github.com/django/django/archive/master.tar.gz -rrequirements/requirements-testing.txt -rrequirements/requirements-optionals.txt From 760268ade2e29a60b151cde15a1a79685970e68a Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Wed, 27 Sep 2017 10:51:45 +0200 Subject: [PATCH 73/88] Fixed a deprecation warning (#5058) --- rest_framework/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 1bcdf763d..7a79ae93c 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -1831,7 +1831,7 @@ class ModelField(Field): def to_internal_value(self, data): rel = get_remote_field(self.model_field, default=None) if rel is not None: - return rel.to._meta.get_field(rel.field_name).to_python(data) + return rel.model._meta.get_field(rel.field_name).to_python(data) return self.model_field.to_python(data) def get_attribute(self, obj): From 5c2290d97380ca15005f7d42ffceae04dc817dba Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 27 Sep 2017 12:23:54 +0200 Subject: [PATCH 74/88] Add note on not using floats with CursorPagination (#5459) Closes #5160, closes #5164. --- docs/api-guide/pagination.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md index 7b5e5b3f6..b28f1616d 100644 --- a/docs/api-guide/pagination.md +++ b/docs/api-guide/pagination.md @@ -179,6 +179,10 @@ Proper usage of cursor pagination should have an ordering field that satisfies t * Should be an unchanging value, such as a timestamp, slug, or other field that is only set once, on creation. * Should be unique, or nearly unique. Millisecond precision timestamps are a good example. This implementation of cursor pagination uses a smart "position plus offset" style that allows it to properly support not-strictly-unique values as the ordering. * Should be a non-nullable value that can be coerced to a string. +* Should not be a float. Precision errors easily lead to incorrect results. + Hint: use decimals instead. + (If you already have a float field and must paginate on that, an + [example `CursorPagination` subclass that uses decimals to limit precision is available here][float_cursor_pagination_example].) * The field should have a database index. Using an ordering field that does not satisfy these constraints will generally still work, but you'll be losing some of the benefits of cursor pagination. @@ -317,3 +321,4 @@ The [`django-rest-framework-link-header-pagination` package][drf-link-header-pag [drf-proxy-pagination]: https://github.com/tuffnatty/drf-proxy-pagination [drf-link-header-pagination]: https://github.com/tbeadle/django-rest-framework-link-header-pagination [disqus-cursor-api]: http://cramer.io/2011/03/08/building-cursors-for-the-disqus-api +[float_cursor_pagination_example]: https://gist.github.com/keturn/8bc88525a183fd41c73ffb729b8865be#file-fpcursorpagination-py From 95d89a166167d3e6f04b5c1f06202ed162c89d30 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 20 Sep 2017 16:28:11 +0200 Subject: [PATCH 75/88] Set version number for 3.7.0 release --- rest_framework/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/__init__.py b/rest_framework/__init__.py index ae130a4d4..bc4ddff06 100644 --- a/rest_framework/__init__.py +++ b/rest_framework/__init__.py @@ -8,7 +8,7 @@ ______ _____ _____ _____ __ """ __title__ = 'Django REST framework' -__version__ = '3.6.4' +__version__ = '3.7.0' __author__ = 'Tom Christie' __license__ = 'BSD 2-Clause' __copyright__ = 'Copyright 2011-2017 Tom Christie' From 3d89edc0b98e7acaa9f4ff198afc0e3715eb3689 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 20 Sep 2017 16:43:10 +0200 Subject: [PATCH 76/88] Rename release notes section Moved issue links to top for easier access. (Can move back later) --- docs/topics/release-notes.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index ef43df670..ab872bdf3 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -38,9 +38,9 @@ You can determine your currently installed version using `pip freeze`: --- -## 3.6.x series +## 3.7.x series -### 3.6.5 +### 3.7.0 * Fix `DjangoModelPermissions` to ensure user authentication before calling the view's `get_queryset()` method. As a side effect, this changes the order of the HTTP method permissions and authentication checks, and 405 responses will only be returned when authenticated. If you want to replicate the old behavior, see the PR for details. [#5376][gh5376] * Deprecated `exclude_from_schema` on `APIView` and `api_view` decorator. Set `schema = None` or `@schema(None)` as appropriate. [#5422][gh5422] @@ -50,6 +50,16 @@ You can determine your currently installed version using `pip freeze`: **Possible backwards compatibility break** if you were relying on datetime strings being UTC. Have client interpret datetimes or [set default or active timezone (docs)][djangodocs-set-timezone] to UTC if needed. + +[gh5376]: https://github.com/encode/django-rest-framework/issues/5376 +[gh5422]: https://github.com/encode/django-rest-framework/issues/5422 +[gh5408]: https://github.com/encode/django-rest-framework/issues/5408 +[gh3732]: https://github.com/encode/django-rest-framework/issues/3732 +[djangodocs-set-timezone]: https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/#default-time-zone-and-current-time-zone + + +## 3.6.x series + ### 3.6.4 **Date**: [21st August 2017][3.6.4-milestone] @@ -1427,9 +1437,3 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh5147]: https://github.com/encode/django-rest-framework/issues/5147 [gh5131]: https://github.com/encode/django-rest-framework/issues/5131 - -[gh5376]: https://github.com/encode/django-rest-framework/issues/5376 -[gh5422]: https://github.com/encode/django-rest-framework/issues/5422 -[gh5408]: https://github.com/encode/django-rest-framework/issues/5408 -[gh3732]: https://github.com/encode/django-rest-framework/issues/3732 -[djangodocs-set-timezone]: https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/#default-time-zone-and-current-time-zone From ad942bbfc2f6c8ff64f12b634453475edb862c0e Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 20 Sep 2017 16:51:04 +0200 Subject: [PATCH 77/88] Add release note for #5273 --- docs/topics/release-notes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index ab872bdf3..44cfe29fb 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -50,12 +50,16 @@ You can determine your currently installed version using `pip freeze`: **Possible backwards compatibility break** if you were relying on datetime strings being UTC. Have client interpret datetimes or [set default or active timezone (docs)][djangodocs-set-timezone] to UTC if needed. +* Removed DjangoFilterBackend inline with deprecation policy. Use `django_filters.rest_framework.FilterSet` and/or `django_filters.rest_framework.DjangoFilterBackend` instead. [#5273][gh5273] + + [gh5376]: https://github.com/encode/django-rest-framework/issues/5376 [gh5422]: https://github.com/encode/django-rest-framework/issues/5422 [gh5408]: https://github.com/encode/django-rest-framework/issues/5408 [gh3732]: https://github.com/encode/django-rest-framework/issues/3732 [djangodocs-set-timezone]: https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/#default-time-zone-and-current-time-zone +[gh5273]: https://github.com/encode/django-rest-framework/issues/5273 ## 3.6.x series From 2834916020b92a2eb1cf74f7265a64406fa58d2b Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Fri, 22 Sep 2017 12:08:04 +0200 Subject: [PATCH 78/88] Add release note for #5440 --- docs/topics/release-notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 44cfe29fb..03328e7be 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -51,6 +51,7 @@ You can determine your currently installed version using `pip freeze`: **Possible backwards compatibility break** if you were relying on datetime strings being UTC. Have client interpret datetimes or [set default or active timezone (docs)][djangodocs-set-timezone] to UTC if needed. * Removed DjangoFilterBackend inline with deprecation policy. Use `django_filters.rest_framework.FilterSet` and/or `django_filters.rest_framework.DjangoFilterBackend` instead. [#5273][gh5273] +* Don't strip microseconds from `time` when encoding. Makes consistent with `datetime`. **BC Change**: Previously only milliseconds were encoded. [#5440][gh5440] @@ -60,6 +61,7 @@ You can determine your currently installed version using `pip freeze`: [gh3732]: https://github.com/encode/django-rest-framework/issues/3732 [djangodocs-set-timezone]: https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/#default-time-zone-and-current-time-zone [gh5273]: https://github.com/encode/django-rest-framework/issues/5273 +[gh5440]: https://github.com/encode/django-rest-framework/issues/5440 ## 3.6.x series From 7f1db28eccecc63d738b23d776099e4d914901ad Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 25 Sep 2017 10:10:11 +0200 Subject: [PATCH 79/88] Add release note for #5265 Strict JSON handling --- docs/topics/release-notes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 03328e7be..526b22e76 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -52,6 +52,8 @@ You can determine your currently installed version using `pip freeze`: * Removed DjangoFilterBackend inline with deprecation policy. Use `django_filters.rest_framework.FilterSet` and/or `django_filters.rest_framework.DjangoFilterBackend` instead. [#5273][gh5273] * Don't strip microseconds from `time` when encoding. Makes consistent with `datetime`. **BC Change**: Previously only milliseconds were encoded. [#5440][gh5440] +* Added `STRICT_JSON` setting (default `True`) to raise exception for the extended float values (`nan`, `inf`, `-inf`) accepted by Python's `json` module. **BC Change**: Previously these values would converted to corresponding strings. Set `STRICT_JSON` to `False` to restore the previous behaviour. [#5265][gh5265] + @@ -62,6 +64,7 @@ You can determine your currently installed version using `pip freeze`: [djangodocs-set-timezone]: https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/#default-time-zone-and-current-time-zone [gh5273]: https://github.com/encode/django-rest-framework/issues/5273 [gh5440]: https://github.com/encode/django-rest-framework/issues/5440 +[gh5265]: https://github.com/encode/django-rest-framework/issues/5265 ## 3.6.x series From a10b9f029e0d16a67b0af0110603abeb02931197 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 25 Sep 2017 11:27:20 +0200 Subject: [PATCH 80/88] Add release note for #5250 --- docs/topics/release-notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 526b22e76..86f709510 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -53,6 +53,7 @@ You can determine your currently installed version using `pip freeze`: * Removed DjangoFilterBackend inline with deprecation policy. Use `django_filters.rest_framework.FilterSet` and/or `django_filters.rest_framework.DjangoFilterBackend` instead. [#5273][gh5273] * Don't strip microseconds from `time` when encoding. Makes consistent with `datetime`. **BC Change**: Previously only milliseconds were encoded. [#5440][gh5440] * Added `STRICT_JSON` setting (default `True`) to raise exception for the extended float values (`nan`, `inf`, `-inf`) accepted by Python's `json` module. **BC Change**: Previously these values would converted to corresponding strings. Set `STRICT_JSON` to `False` to restore the previous behaviour. [#5265][gh5265] +* Add support for `page_size` parameter in CursorPaginator class [#5250][gh5250] @@ -65,6 +66,7 @@ You can determine your currently installed version using `pip freeze`: [gh5273]: https://github.com/encode/django-rest-framework/issues/5273 [gh5440]: https://github.com/encode/django-rest-framework/issues/5440 [gh5265]: https://github.com/encode/django-rest-framework/issues/5265 +[gh5250]: https://github.com/encode/django-rest-framework/issues/5250 ## 3.6.x series From 20ef8caadf304b4f1e2d9e889948b29e84feaee7 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 25 Sep 2017 15:35:17 +0200 Subject: [PATCH 81/88] Add release notes for #5170 --- docs/topics/release-notes.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 86f709510..9d4a9deee 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -51,9 +51,14 @@ You can determine your currently installed version using `pip freeze`: **Possible backwards compatibility break** if you were relying on datetime strings being UTC. Have client interpret datetimes or [set default or active timezone (docs)][djangodocs-set-timezone] to UTC if needed. * Removed DjangoFilterBackend inline with deprecation policy. Use `django_filters.rest_framework.FilterSet` and/or `django_filters.rest_framework.DjangoFilterBackend` instead. [#5273][gh5273] -* Don't strip microseconds from `time` when encoding. Makes consistent with `datetime`. **BC Change**: Previously only milliseconds were encoded. [#5440][gh5440] -* Added `STRICT_JSON` setting (default `True`) to raise exception for the extended float values (`nan`, `inf`, `-inf`) accepted by Python's `json` module. **BC Change**: Previously these values would converted to corresponding strings. Set `STRICT_JSON` to `False` to restore the previous behaviour. [#5265][gh5265] +* Don't strip microseconds from `time` when encoding. Makes consistent with `datetime`. + **BC Change**: Previously only milliseconds were encoded. [#5440][gh5440] +* Added `STRICT_JSON` setting (default `True`) to raise exception for the extended float values (`nan`, `inf`, `-inf`) accepted by Python's `json` module. + **BC Change**: Previously these values would converted to corresponding strings. Set `STRICT_JSON` to `False` to restore the previous behaviour. [#5265][gh5265] * Add support for `page_size` parameter in CursorPaginator class [#5250][gh5250] +* Make `DEFAULT_PAGINATION_CLASS` `None` by default. + **BC Change**: If your were **just** setting `PAGE_SIZE` to enable pagination you will need to add `DEFAULT_PAGINATION_CLASS`. + The previous default was `rest_framework.pagination.PageNumberPagination`. There is a system check warning to catch this case. You may silence that if you are setting pagination class on a per-view basis. [#5170][gh5170] @@ -67,6 +72,7 @@ You can determine your currently installed version using `pip freeze`: [gh5440]: https://github.com/encode/django-rest-framework/issues/5440 [gh5265]: https://github.com/encode/django-rest-framework/issues/5265 [gh5250]: https://github.com/encode/django-rest-framework/issues/5250 +[gh5170]: https://github.com/encode/django-rest-framework/issues/5170 ## 3.6.x series From 482e9292cbb3a353a97d3a8abc0c62a1b45b202d Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 26 Sep 2017 09:13:09 +0200 Subject: [PATCH 82/88] Add release notes for #5443 --- docs/topics/release-notes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 9d4a9deee..8b40a2964 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -59,7 +59,7 @@ You can determine your currently installed version using `pip freeze`: * Make `DEFAULT_PAGINATION_CLASS` `None` by default. **BC Change**: If your were **just** setting `PAGE_SIZE` to enable pagination you will need to add `DEFAULT_PAGINATION_CLASS`. The previous default was `rest_framework.pagination.PageNumberPagination`. There is a system check warning to catch this case. You may silence that if you are setting pagination class on a per-view basis. [#5170][gh5170] - +* Catch `APIException` from `get_serializer_fields` in schema generation. [#5443][gh5443] @@ -73,6 +73,7 @@ You can determine your currently installed version using `pip freeze`: [gh5265]: https://github.com/encode/django-rest-framework/issues/5265 [gh5250]: https://github.com/encode/django-rest-framework/issues/5250 [gh5170]: https://github.com/encode/django-rest-framework/issues/5170 +[gh5443]: https://github.com/encode/django-rest-framework/issues/5443 ## 3.6.x series From b79ff1d61fd675fa35021b7de12d501b2139a8df Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 26 Sep 2017 09:17:08 +0200 Subject: [PATCH 83/88] Add release notes for #5448 --- docs/topics/release-notes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 8b40a2964..156c3b760 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -60,6 +60,8 @@ You can determine your currently installed version using `pip freeze`: **BC Change**: If your were **just** setting `PAGE_SIZE` to enable pagination you will need to add `DEFAULT_PAGINATION_CLASS`. The previous default was `rest_framework.pagination.PageNumberPagination`. There is a system check warning to catch this case. You may silence that if you are setting pagination class on a per-view basis. [#5170][gh5170] * Catch `APIException` from `get_serializer_fields` in schema generation. [#5443][gh5443] +* Allow custom authentication and permission classes when using `include_docs_urls` [#5448][gh5448] + @@ -74,6 +76,7 @@ You can determine your currently installed version using `pip freeze`: [gh5250]: https://github.com/encode/django-rest-framework/issues/5250 [gh5170]: https://github.com/encode/django-rest-framework/issues/5170 [gh5443]: https://github.com/encode/django-rest-framework/issues/5443 +[gh5448]: https://github.com/encode/django-rest-framework/issues/5448 ## 3.6.x series From 5f0e0db26989e81ea6c6f47474d9bee03a6fa952 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 26 Sep 2017 10:00:14 +0200 Subject: [PATCH 84/88] Add release notes for #5452 --- docs/topics/release-notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 156c3b760..2b52caa99 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -61,6 +61,7 @@ You can determine your currently installed version using `pip freeze`: The previous default was `rest_framework.pagination.PageNumberPagination`. There is a system check warning to catch this case. You may silence that if you are setting pagination class on a per-view basis. [#5170][gh5170] * Catch `APIException` from `get_serializer_fields` in schema generation. [#5443][gh5443] * Allow custom authentication and permission classes when using `include_docs_urls` [#5448][gh5448] +* Defer translated string evaluation on validators. [#5452][gh5452] @@ -77,6 +78,7 @@ You can determine your currently installed version using `pip freeze`: [gh5170]: https://github.com/encode/django-rest-framework/issues/5170 [gh5443]: https://github.com/encode/django-rest-framework/issues/5443 [gh5448]: https://github.com/encode/django-rest-framework/issues/5448 +[gh5452]: https://github.com/encode/django-rest-framework/issues/5452 ## 3.6.x series From a71ddd1e92604beec2a24705f0cbfef912ee42eb Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 26 Sep 2017 10:25:15 +0200 Subject: [PATCH 85/88] Add release not for #5342 --- docs/topics/release-notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 2b52caa99..ec49fb13f 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -62,6 +62,7 @@ You can determine your currently installed version using `pip freeze`: * Catch `APIException` from `get_serializer_fields` in schema generation. [#5443][gh5443] * Allow custom authentication and permission classes when using `include_docs_urls` [#5448][gh5448] * Defer translated string evaluation on validators. [#5452][gh5452] +* Added default value for 'detail' param into 'ValidationError' exception [#5342][gh5342] @@ -79,6 +80,7 @@ You can determine your currently installed version using `pip freeze`: [gh5443]: https://github.com/encode/django-rest-framework/issues/5443 [gh5448]: https://github.com/encode/django-rest-framework/issues/5448 [gh5452]: https://github.com/encode/django-rest-framework/issues/5452 +[gh5342]: https://github.com/encode/django-rest-framework/issues/5342 ## 3.6.x series From 9eeaf60a6a6b4331bb504959916e6dee163cce55 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 27 Sep 2017 09:15:32 +0200 Subject: [PATCH 86/88] Add release notes for 5454 --- docs/topics/release-notes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index ec49fb13f..b57cca4ed 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -63,7 +63,7 @@ You can determine your currently installed version using `pip freeze`: * Allow custom authentication and permission classes when using `include_docs_urls` [#5448][gh5448] * Defer translated string evaluation on validators. [#5452][gh5452] * Added default value for 'detail' param into 'ValidationError' exception [#5342][gh5342] - +* Adjust schema get_filter_fields rules to match framework [#5454][gh5454] @@ -81,6 +81,7 @@ You can determine your currently installed version using `pip freeze`: [gh5448]: https://github.com/encode/django-rest-framework/issues/5448 [gh5452]: https://github.com/encode/django-rest-framework/issues/5452 [gh5342]: https://github.com/encode/django-rest-framework/issues/5342 +[gh5454]: https://github.com/encode/django-rest-framework/issues/5454 ## 3.6.x series From eab1a6e0be762f6a5e15cfae5ca93456757472b0 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Wed, 27 Sep 2017 11:02:49 +0200 Subject: [PATCH 87/88] Add release notes for #5058 & #5457 Remove Django 1.8 & 1.9 from README and setup.py --- README.md | 4 ++-- docs/topics/release-notes.md | 5 +++++ setup.py | 3 --- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 814da6e92..87e5e3da5 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ There is a live example API for testing purposes, [available here][sandbox]. # Requirements -* Python (2.7, 3.2, 3.3, 3.4, 3.5, 3.6) -* Django (1.8, 1.9, 1.10, 1.11) +* Python (2.7, 3.4, 3.5, 3.6) +* Django (1.10, 1.11) # Installation diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index b57cca4ed..8b94c41ae 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -64,9 +64,14 @@ You can determine your currently installed version using `pip freeze`: * Defer translated string evaluation on validators. [#5452][gh5452] * Added default value for 'detail' param into 'ValidationError' exception [#5342][gh5342] * Adjust schema get_filter_fields rules to match framework [#5454][gh5454] +* Updated test matrix to add Django 2.0 and drop Django 1.8 & 1.9 + **BC Change**: This removes Django 1.8 and Django 1.9 from Django REST Framework supported versions. [#5457][gh5457] +* Fixed a deprecation warning in serializers.ModelField [#5058][gh5058] +[gh5058]: https://github.com/encode/django-rest-framework/issues/5058 +[gh5457]: https://github.com/encode/django-rest-framework/issues/5457 [gh5376]: https://github.com/encode/django-rest-framework/issues/5376 [gh5422]: https://github.com/encode/django-rest-framework/issues/5422 [gh5408]: https://github.com/encode/django-rest-framework/issues/5408 diff --git a/setup.py b/setup.py index 36227938b..f9f8a7bb4 100755 --- a/setup.py +++ b/setup.py @@ -92,8 +92,6 @@ setup( 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Framework :: Django', - 'Framework :: Django :: 1.8', - 'Framework :: Django :: 1.9', 'Framework :: Django :: 1.10', 'Framework :: Django :: 1.11', 'Intended Audience :: Developers', @@ -103,7 +101,6 @@ setup( 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Topic :: Internet :: WWW/HTTP', From 03aee657b12ab9f9b5ef79c256327fc1513cde9e Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Thu, 28 Sep 2017 10:12:43 +0200 Subject: [PATCH 88/88] Release notes for merged 3.6.5 milestone tickets Tickets migrated to 3.7.0 milestone. --- docs/topics/release-notes.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 8b94c41ae..beede65d6 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -44,7 +44,7 @@ You can determine your currently installed version using `pip freeze`: * Fix `DjangoModelPermissions` to ensure user authentication before calling the view's `get_queryset()` method. As a side effect, this changes the order of the HTTP method permissions and authentication checks, and 405 responses will only be returned when authenticated. If you want to replicate the old behavior, see the PR for details. [#5376][gh5376] * Deprecated `exclude_from_schema` on `APIView` and `api_view` decorator. Set `schema = None` or `@schema(None)` as appropriate. [#5422][gh5422] -* Timezone-aware `DateTimeField`s now respect active or default `timezone` during serialization, instead of always using UTC. +* Timezone-aware `DateTimeField`s now respect active or default `timezone` during serialization, instead of always using UTC. [#5435][gh5435] Resolves inconsistency whereby instances were serialised with supplied datetime for `create` but UTC for `retrieve`. [#3732][gh3732] @@ -67,9 +67,41 @@ You can determine your currently installed version using `pip freeze`: * Updated test matrix to add Django 2.0 and drop Django 1.8 & 1.9 **BC Change**: This removes Django 1.8 and Django 1.9 from Django REST Framework supported versions. [#5457][gh5457] * Fixed a deprecation warning in serializers.ModelField [#5058][gh5058] +* Added a more explicit error message when `get_queryset` returned `None` [#5348][gh5348] +* Fix docs for Response `data` description [#5361][gh5361] +* Fix __pychache__/.pyc excludes when packaging [#5373][gh5373] +* Fix default value handling for dotted sources [#5375][gh5375] +* Ensure content_type is set when passing empty body to RequestFactory [#5351][gh5351] +* Fix ErrorDetail Documentation [#5380][gh5380] +* Allow optional content in the generic content form [#5372][gh5372] +* Updated supported values for the NullBooleanField [#5387][gh5387] +* Fix ModelSerializer custom named fields with source on model [#5388][gh5388] +* Fixed the MultipleFieldLookupMixin documentation example to properly check for object level permission [#5398][gh5398] +* Update get_object() example in permissions.md [#5401][gh5401] +* Fix authtoken managment command [#5415][gh5415] +* Fix schema generation markdown [#5421][gh5421] +* Allow `ChoiceField.choices` to be set dynamically [#5426][gh5426] +* Add the project layout to the quickstart [#5434][gh5434] + +[gh5435]: https://github.com/encode/django-rest-framework/issues/5435 +[gh5434]: https://github.com/encode/django-rest-framework/issues/5434 +[gh5426]: https://github.com/encode/django-rest-framework/issues/5426 +[gh5421]: https://github.com/encode/django-rest-framework/issues/5421 +[gh5415]: https://github.com/encode/django-rest-framework/issues/5415 +[gh5401]: https://github.com/encode/django-rest-framework/issues/5401 +[gh5398]: https://github.com/encode/django-rest-framework/issues/5398 +[gh5388]: https://github.com/encode/django-rest-framework/issues/5388 +[gh5387]: https://github.com/encode/django-rest-framework/issues/5387 +[gh5372]: https://github.com/encode/django-rest-framework/issues/5372 +[gh5380]: https://github.com/encode/django-rest-framework/issues/5380 +[gh5351]: https://github.com/encode/django-rest-framework/issues/5351 +[gh5375]: https://github.com/encode/django-rest-framework/issues/5375 +[gh5373]: https://github.com/encode/django-rest-framework/issues/5373 +[gh5361]: https://github.com/encode/django-rest-framework/issues/5361 +[gh5348]: https://github.com/encode/django-rest-framework/issues/5348 [gh5058]: https://github.com/encode/django-rest-framework/issues/5058 [gh5457]: https://github.com/encode/django-rest-framework/issues/5457 [gh5376]: https://github.com/encode/django-rest-framework/issues/5376