[Python-modules-commits] [djangorestframework] 01/07: Import djangorestframework_3.3.2.orig.tar.gz

Brian May bam at moszumanska.debian.org
Sun Jan 3 03:01:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

bam pushed a commit to branch master
in repository djangorestframework.

commit 1bd539431e14611590d5a1ff551253bdb0376e67
Author: Brian May <bam at debian.org>
Date:   Sun Jan 3 13:45:27 2016 +1100

    Import djangorestframework_3.3.2.orig.tar.gz
---
 .isort.cfg                                         |   1 +
 docs/api-guide/fields.md                           |   2 +-
 docs/api-guide/filtering.md                        |   4 +-
 docs/api-guide/generic-views.md                    |  35 +-
 docs/api-guide/pagination.md                       |   3 +
 docs/api-guide/parsers.md                          |   3 +
 docs/api-guide/renderers.md                        |   9 +
 docs/api-guide/serializers.md                      |   4 +
 docs/api-guide/versioning.md                       |   4 +-
 docs/index.md                                      |   3 +-
 docs/topics/html-and-forms.md                      | 432 +++++++++++----------
 docs/topics/release-notes.md                       |  71 ++++
 docs/tutorial/4-authentication-and-permissions.md  |   2 +-
 requirements/requirements-codestyle.txt            |   2 +-
 requirements/requirements-packaging.txt            |   2 +-
 rest_framework/__init__.py                         |   2 +-
 rest_framework/authtoken/views.py                  |   2 +-
 rest_framework/compat.py                           |  53 +++
 rest_framework/fields.py                           |  10 +-
 rest_framework/filters.py                          |  27 +-
 rest_framework/locale/ach/LC_MESSAGES/django.mo    | Bin 0 -> 513 bytes
 .../locale/{fr_CA => ach}/LC_MESSAGES/django.po    | 144 ++++---
 rest_framework/locale/ar/LC_MESSAGES/django.mo     | Bin 4888 -> 4888 bytes
 rest_framework/locale/ar/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/be/LC_MESSAGES/django.mo     | Bin 655 -> 655 bytes
 rest_framework/locale/be/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/ca/LC_MESSAGES/django.mo     | Bin 9749 -> 9749 bytes
 rest_framework/locale/ca/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/ca_ES/LC_MESSAGES/django.mo  | Bin 528 -> 528 bytes
 rest_framework/locale/ca_ES/LC_MESSAGES/django.po  | 140 ++++---
 rest_framework/locale/cs/LC_MESSAGES/django.mo     | Bin 9140 -> 9140 bytes
 rest_framework/locale/cs/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/da/LC_MESSAGES/django.mo     | Bin 8905 -> 9682 bytes
 rest_framework/locale/da/LC_MESSAGES/django.po     | 155 +++++---
 .../locale/{en_CA => da_DK}/LC_MESSAGES/django.mo  | Bin 529 -> 529 bytes
 .../locale/{gl => da_DK}/LC_MESSAGES/django.po     | 144 ++++---
 rest_framework/locale/de/LC_MESSAGES/django.mo     | Bin 9544 -> 10465 bytes
 rest_framework/locale/de/LC_MESSAGES/django.po     | 156 +++++---
 rest_framework/locale/en/LC_MESSAGES/django.mo     | Bin 9476 -> 9770 bytes
 rest_framework/locale/en/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/en_AU/LC_MESSAGES/django.mo  | Bin 0 -> 532 bytes
 .../locale/{gl => en_AU}/LC_MESSAGES/django.po     | 144 ++++---
 rest_framework/locale/en_CA/LC_MESSAGES/django.mo  | Bin 529 -> 529 bytes
 rest_framework/locale/en_CA/LC_MESSAGES/django.po  | 140 ++++---
 rest_framework/locale/en_US/LC_MESSAGES/django.mo  | Bin 378 -> 378 bytes
 rest_framework/locale/en_US/LC_MESSAGES/django.po  | 138 ++++---
 rest_framework/locale/es/LC_MESSAGES/django.mo     | Bin 10127 -> 10509 bytes
 rest_framework/locale/es/LC_MESSAGES/django.po     | 144 ++++---
 rest_framework/locale/et/LC_MESSAGES/django.mo     | Bin 8836 -> 8836 bytes
 rest_framework/locale/et/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/fi/LC_MESSAGES/django.mo     | Bin 0 -> 10068 bytes
 rest_framework/locale/fi/LC_MESSAGES/django.po     | 428 ++++++++++++++++++++
 rest_framework/locale/fr/LC_MESSAGES/django.mo     | Bin 10193 -> 10501 bytes
 rest_framework/locale/fr/LC_MESSAGES/django.po     | 142 ++++---
 rest_framework/locale/fr_CA/LC_MESSAGES/django.mo  | Bin 527 -> 527 bytes
 rest_framework/locale/fr_CA/LC_MESSAGES/django.po  | 140 ++++---
 rest_framework/locale/gl/LC_MESSAGES/django.mo     | Bin 515 -> 515 bytes
 rest_framework/locale/gl/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/gl_ES/LC_MESSAGES/django.mo  | Bin 669 -> 669 bytes
 rest_framework/locale/gl_ES/LC_MESSAGES/django.po  | 140 ++++---
 .../locale/{ca_ES => he_IL}/LC_MESSAGES/django.mo  | Bin 528 -> 528 bytes
 .../locale/{gl => he_IL}/LC_MESSAGES/django.po     | 144 ++++---
 rest_framework/locale/hu/LC_MESSAGES/django.mo     | Bin 9228 -> 9228 bytes
 rest_framework/locale/hu/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/id/LC_MESSAGES/django.mo     | Bin 510 -> 510 bytes
 rest_framework/locale/id/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/it/LC_MESSAGES/django.mo     | Bin 9512 -> 9512 bytes
 rest_framework/locale/it/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/ja/LC_MESSAGES/django.mo     | Bin 11341 -> 11341 bytes
 rest_framework/locale/ja/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/ko_KR/LC_MESSAGES/django.mo  | Bin 10148 -> 10148 bytes
 rest_framework/locale/ko_KR/LC_MESSAGES/django.po  | 140 ++++---
 rest_framework/locale/mk/LC_MESSAGES/django.mo     | Bin 10744 -> 10744 bytes
 rest_framework/locale/mk/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/nb/LC_MESSAGES/django.mo     | Bin 524 -> 9902 bytes
 rest_framework/locale/nb/LC_MESSAGES/django.po     | 311 ++++++++-------
 rest_framework/locale/nl/LC_MESSAGES/django.mo     | Bin 9267 -> 9267 bytes
 rest_framework/locale/nl/LC_MESSAGES/django.po     | 140 ++++---
 .../locale/{nb => nn}/LC_MESSAGES/django.mo        | Bin 524 -> 524 bytes
 .../locale/{gl => nn}/LC_MESSAGES/django.po        | 144 ++++---
 rest_framework/locale/no/LC_MESSAGES/django.mo     | Bin 0 -> 516 bytes
 .../locale/{gl => no}/LC_MESSAGES/django.po        | 144 ++++---
 rest_framework/locale/pl/LC_MESSAGES/django.mo     | Bin 9602 -> 10528 bytes
 rest_framework/locale/pl/LC_MESSAGES/django.po     | 154 +++++---
 rest_framework/locale/pt/LC_MESSAGES/django.mo     | Bin 517 -> 517 bytes
 rest_framework/locale/pt/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/pt_BR/LC_MESSAGES/django.mo  | Bin 9974 -> 10343 bytes
 rest_framework/locale/pt_BR/LC_MESSAGES/django.po  | 144 ++++---
 rest_framework/locale/pt_PT/LC_MESSAGES/django.mo  | Bin 534 -> 534 bytes
 rest_framework/locale/pt_PT/LC_MESSAGES/django.po  | 140 ++++---
 rest_framework/locale/ro/LC_MESSAGES/django.mo     | Bin 0 -> 556 bytes
 .../locale/{fr_CA => ro}/LC_MESSAGES/django.po     | 146 ++++---
 rest_framework/locale/ru/LC_MESSAGES/django.mo     | Bin 11487 -> 11487 bytes
 rest_framework/locale/ru/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/sk/LC_MESSAGES/django.mo     | Bin 9524 -> 9524 bytes
 rest_framework/locale/sk/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/sv/LC_MESSAGES/django.mo     | Bin 9519 -> 10151 bytes
 rest_framework/locale/sv/LC_MESSAGES/django.po     | 150 ++++---
 rest_framework/locale/tr/LC_MESSAGES/django.mo     | Bin 9211 -> 10269 bytes
 rest_framework/locale/tr/LC_MESSAGES/django.po     | 157 ++++----
 rest_framework/locale/tr_TR/LC_MESSAGES/django.mo  | Bin 522 -> 1933 bytes
 rest_framework/locale/tr_TR/LC_MESSAGES/django.po  | 173 +++++----
 rest_framework/locale/uk/LC_MESSAGES/django.mo     | Bin 590 -> 590 bytes
 rest_framework/locale/uk/LC_MESSAGES/django.po     | 140 ++++---
 rest_framework/locale/vi/LC_MESSAGES/django.mo     | Bin 510 -> 510 bytes
 rest_framework/locale/vi/LC_MESSAGES/django.po     | 140 ++++---
 .../locale/zh-Hans/LC_MESSAGES/django.mo           | Bin 0 -> 9894 bytes
 .../{zh_CN => zh-Hans}/LC_MESSAGES/django.po       | 165 ++++----
 .../{en_CA => zh-Hant}/LC_MESSAGES/django.mo       | Bin 529 -> 529 bytes
 .../locale/{id => zh-Hant}/LC_MESSAGES/django.po   | 144 ++++---
 rest_framework/locale/zh_CN/LC_MESSAGES/django.mo  | Bin 9261 -> 9895 bytes
 rest_framework/locale/zh_CN/LC_MESSAGES/django.po  | 151 ++++---
 rest_framework/locale/zh_TW/LC_MESSAGES/django.mo  | Bin 522 -> 522 bytes
 rest_framework/locale/zh_TW/LC_MESSAGES/django.po  | 140 ++++---
 rest_framework/pagination.py                       |  19 +-
 rest_framework/permissions.py                      |  16 +-
 rest_framework/relations.py                        |   3 +
 rest_framework/renderers.py                        |  35 +-
 .../static/rest_framework/css/bootstrap-tweaks.css |   5 +
 .../templates/rest_framework/admin/list.html       |  15 +-
 rest_framework/templates/rest_framework/base.html  |  24 +-
 rest_framework/templatetags/rest_framework.py      |  11 +-
 rest_framework/urls.py                             |   5 +-
 rest_framework/utils/model_meta.py                 |  10 +-
 rest_framework/utils/representation.py             |   2 +-
 rest_framework/utils/serializer_helpers.py         |   2 +-
 tests/test_bound_fields.py                         |  37 ++
 tests/test_fields.py                               |  14 +-
 tests/test_pagination.py                           |  59 +++
 tests/test_relations.py                            |  11 +
 tests/test_request.py                              |   5 +-
 tox.ini                                            |  19 +-
 132 files changed, 5045 insertions(+), 3140 deletions(-)

diff --git a/.isort.cfg b/.isort.cfg
index bd5648e..4d4a6a5 100644
--- a/.isort.cfg
+++ b/.isort.cfg
@@ -2,5 +2,6 @@
 skip=.tox
 atomic=true
 multi_line_output=5
+known_standard_library=types
 known_third_party=pytest,django
 known_first_party=rest_framework
diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md
index bdc52be..4118f6d 100644
--- a/docs/api-guide/fields.md
+++ b/docs/api-guide/fields.md
@@ -572,7 +572,7 @@ Let's look at an example of serializing a class that represents an RGB color val
 
 By default field values are treated as mapping to an attribute on the object.  If you need to customize how the field value is accessed and set you need to override `.get_attribute()` and/or `.get_value()`.
 
-As an example, let's create a field that can be used represent the class name of the object being serialized:
+As an example, let's create a field that can be used to represent the class name of the object being serialized:
 
     class ClassNameField(serializers.Field):
         def get_attribute(self, obj):
diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md
index 6bdbdfe..9e5f605 100644
--- a/docs/api-guide/filtering.md
+++ b/docs/api-guide/filtering.md
@@ -145,11 +145,11 @@ To use REST framework's `DjangoFilterBackend`, first install `django-filter`.
 
     pip install django-filter
 
-If you are using the browsable API or admin API you may also want to install `crispy-forms`, which will enhance the presentation of the filter forms in HTML views, by allowing them to render Bootstrap 3 HTML.
+If you are using the browsable API or admin API you may also want to install `django-crispy-forms`, which will enhance the presentation of the filter forms in HTML views, by allowing them to render Bootstrap 3 HTML.
 
     pip install django-crispy-forms
 
-With crispy forms installed, the browsable API will present a filtering control for `DjangoFilterBackend`, like so:
+With crispy forms installed and added to Django's `INSTALLED_APPS`, the browsable API will present a filtering control for `DjangoFilterBackend`, like so:
 
 ![Django Filter](../img/django-filter.png)
 
diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md
index 7970b27..4a95812 100644
--- a/docs/api-guide/generic-views.md
+++ b/docs/api-guide/generic-views.md
@@ -35,14 +35,6 @@ For more complex cases you might also want to override various methods on the vi
         serializer_class = UserSerializer
         permission_classes = (IsAdminUser,)
 
-        def get_paginate_by(self):
-            """
-            Use smaller pagination for HTML representations.
-            """
-            if self.request.accepted_renderer.format == 'html':
-                return 20
-            return 100
-
         def list(self, request):
             # Note the use of `get_queryset()` instead of `self.queryset`
             queryset = self.get_queryset()
@@ -125,22 +117,22 @@ For example:
 Note that if your API doesn't include any object level permissions, you may optionally exclude the `self.check_object_permissions`, and simply return the object from the `get_object_or_404` lookup.
 
 #### `filter_queryset(self, queryset)`       
-       
+
 Given a queryset, filter it with whichever filter backends are in use, returning a new queryset.   
-        
+
 For example:       
-       
+
     def filter_queryset(self, queryset):
         filter_backends = (CategoryFilter,)
-        
+
         if 'geo_route' in self.request.query_params:
             filter_backends = (GeoRouteFilter, CategoryFilter)
         elif 'geo_point' in self.request.query_params:
             filter_backends = (GeoPointFilter, CategoryFilter)
-        
+
         for backend in list(filter_backends):
             queryset = backend().filter_queryset(self.request, queryset, view=self)
-        
+
         return queryset
 
 #### `get_serializer_class(self)`
@@ -156,19 +148,6 @@ For example:
             return FullAccountSerializer
         return BasicAccountSerializer
 
-#### `get_paginate_by(self)`
-
-Returns the page size to use with pagination.  By default this uses the `paginate_by` attribute, and may be overridden by the client if the `paginate_by_param` attribute is set.
-
-You may want to override this method to provide more complex behavior, such as modifying page sizes based on the media type of the response.
-
-For example:
-
-    def get_paginate_by(self):
-        if self.request.accepted_renderer.format == 'html':
-            return 20
-        return 100
-
 **Save and deletion hooks**:
 
 The following methods are provided by the mixin classes, and provide easy overriding of the object save or deletion behavior.
@@ -416,5 +395,3 @@ The [django-rest-framework-bulk package][django-rest-framework-bulk] implements
 [DestroyModelMixin]: #destroymodelmixin
 [django-rest-framework-bulk]: https://github.com/miki725/django-rest-framework-bulk
 [django-rest-multiple-models]: https://github.com/Axiologue/DjangoRestMultipleModels
-
-
diff --git a/docs/api-guide/pagination.md b/docs/api-guide/pagination.md
index 881fbf1..da096bd 100644
--- a/docs/api-guide/pagination.md
+++ b/docs/api-guide/pagination.md
@@ -17,6 +17,8 @@ The built-in styles currently all use links included as part of the content of t
 
 Pagination is only performed automatically if you're using the generic views or viewsets. If you're using a regular `APIView`, you'll need to call into the pagination API yourself to ensure you return a paginated response. See the source code for the `mixins.ListModelMixin` and `generics.GenericAPIView` classes for an example.
 
+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` settings key. For example, to use the built-in limit/offset pagination, you would do:
@@ -95,6 +97,7 @@ The `PageNumberPagination` class includes a number of attributes that may be ove
 
 To set these attributes you should override the `PageNumberPagination` class, and then enable your custom pagination class as above.
 
+* `django_paginator_class` - The Django Paginator class to use. Default is `django.core.paginator.Paginator`, which should be fine for most usecases.
 * `page_size` - A numeric value indicating the page size. If set, this overrides the `PAGE_SIZE` setting. Defaults to the same value as the `PAGE_SIZE` settings key.
 * `page_query_param` - A string value indicating the name of the query parameter to use for the pagination control.
 * `page_size_query_param` - If set, this is a string value indicating the name of a query parameter that allows the client to set the page size on a per-request basis. Defaults to `None`, indicating that the client may not control the requested page size.
diff --git a/docs/api-guide/parsers.md b/docs/api-guide/parsers.md
index d5975ab..84fd6e5 100644
--- a/docs/api-guide/parsers.md
+++ b/docs/api-guide/parsers.md
@@ -51,6 +51,9 @@ using the `APIView` class based views.
             return Response({'received data': request.data})
 
 Or, if you're using the `@api_view` decorator with function based views.
+    
+    from rest_framework.decorators import api_view
+    from rest_framework.decorators import parser_classes
 
     @api_view(['POST'])
     @parser_classes((JSONParser,))
diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md
index fecdee8..b495fd0 100644
--- a/docs/api-guide/renderers.md
+++ b/docs/api-guide/renderers.md
@@ -187,6 +187,15 @@ This renderer is suitable for CRUD-style web APIs that should also present a use
 
 Note that views that have nested or list serializers for their input won't work well with the `AdminRenderer`, as the HTML forms are unable to properly support them.
 
+**Note**: The `AdminRenderer` is only able to include links to detail pages when a properly configured `URL_FIELD_NAME` (`url` by default) attribute is present in the data. For `HyperlinkedModelSerializer` this will be the case, but for `ModelSerializer` or plain `Serializer` classes you'll need to make sure to include the field explicitly. For example here we use models `get_absolute_url` method:
+
+    class AccountSerializer(serializers.ModelSerializer):
+        url = serializers.CharField(source='get_absolute_url', read_only=True)
+
+        class Meta:
+            model = Account
+
+
 **.media_type**: `text/html`
 
 **.format**: `'.admin'`
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md
index 0be36fd..78c2dd0 100644
--- a/docs/api-guide/serializers.md
+++ b/docs/api-guide/serializers.md
@@ -800,6 +800,10 @@ Here's an example of how you might choose to implement multiple updates:
             return ret
 
     class BookSerializer(serializers.Serializer):
+        # We need to identify elements in the list using their primary key,
+        # so use a writable field here, rather than the default which would be read-only.
+        id = serializers.IntegerField()
+
         ...
         class Meta:
             list_serializer_class = BookListSerializer
diff --git a/docs/api-guide/versioning.md b/docs/api-guide/versioning.md
index 06b0056..f6e32f4 100644
--- a/docs/api-guide/versioning.md
+++ b/docs/api-guide/versioning.md
@@ -130,12 +130,12 @@ Your URL conf must include a pattern that matches the version with a `'version'`
 
     urlpatterns = [
         url(
-            r'^(?P<version>[v1|v2]+)/bookings/$',
+            r'^(?P<version>(v1|v2))/bookings/$',
             bookings_list,
             name='bookings-list'
         ),
         url(
-            r'^(?P<version>[v1|v2]+)/bookings/(?P<pk>[0-9]+)/$',
+            r'^(?P<version>(v1|v2))/bookings/(?P<pk>[0-9]+)/$',
             bookings_detail,
             name='bookings-detail'
         )
diff --git a/docs/index.md b/docs/index.md
index edfae2a..622e35a 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -86,7 +86,7 @@ If you're intending to use the browsable API you'll probably also want to add RE
         url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
     ]
 
-Note that the URL path can be whatever you want, but you must include `'rest_framework.urls'` with the `'rest_framework'` namespace.
+Note that the URL path can be whatever you want, but you must include `'rest_framework.urls'` with the `'rest_framework'` namespace. You may leave out the namespace in Django 1.9+, and REST framework will set it for you.
 
 ## Example
 
@@ -258,6 +258,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 [eventbrite]: https://www.eventbrite.co.uk/about/
 [markdown]: http://pypi.python.org/pypi/Markdown/
 [django-filter]: http://pypi.python.org/pypi/django-filter
+[django-crispy-forms]: https://github.com/maraujop/django-crispy-forms
 [django-guardian]: https://github.com/lukaszb/django-guardian
 [0.4]: https://github.com/tomchristie/django-rest-framework/tree/0.4.X
 [image]: img/quickstart.png
diff --git a/docs/topics/html-and-forms.md b/docs/topics/html-and-forms.md
index 82dd216..7b8f1cc 100644
--- a/docs/topics/html-and-forms.md
+++ b/docs/topics/html-and-forms.md
@@ -1,215 +1,219 @@
-# HTML & Forms
-
-REST framework is suitable for returning both API style responses, and regular HTML pages. Additionally, serializers can used as HTML forms and rendered in templates.
-
-## Rendering HTML
-
-In order to return HTML responses you'll need to either `TemplateHTMLRenderer`, or `StaticHTMLRenderer`.
-
-The `TemplateHTMLRenderer` class expects the response to contain a dictionary of context data, and renders an HTML page based on a template that must be specified either in the view or on the response.
-
-The `StaticHTMLRender` class expects the response to contain a string of the pre-rendered HTML content.
-
-Because static HTML pages typically have different behavior from API responses you'll probably need to write any HTML views explicitly, rather than relying on the built-in generic views.
-
-Here's an example of a view that returns a list of "Profile" instances, rendered in an HTML template:
-
-**views.py**:
-
-    from my_project.example.models import Profile
-    from rest_framework.renderers import TemplateHTMLRenderer
-    from rest_framework.response import Response
-    from rest_framework.views import APIView
-
-
-    class ProfileList(APIView):
-        renderer_classes = [TemplateHTMLRenderer]
-        template_name = 'profile_list.html'
-
-        def get(self, request):
-            queryset = Profile.objects.all()
-            return Response({'profiles': queryset})
-
-**profile_list.html**:
-
-    <html><body>
-    <h1>Profiles</h1>
-    <ul>
-        {% for profile in profiles %}
+# HTML & Forms
+
+REST framework is suitable for returning both API style responses, and regular HTML pages. Additionally, serializers can used as HTML forms and rendered in templates.
+
+## Rendering HTML
+
+In order to return HTML responses you'll need to either `TemplateHTMLRenderer`, or `StaticHTMLRenderer`.
+
+The `TemplateHTMLRenderer` class expects the response to contain a dictionary of context data, and renders an HTML page based on a template that must be specified either in the view or on the response.
+
+The `StaticHTMLRender` class expects the response to contain a string of the pre-rendered HTML content.
+
+Because static HTML pages typically have different behavior from API responses you'll probably need to write any HTML views explicitly, rather than relying on the built-in generic views.
+
+Here's an example of a view that returns a list of "Profile" instances, rendered in an HTML template:
+
+**views.py**:
+
+    from my_project.example.models import Profile
+    from rest_framework.renderers import TemplateHTMLRenderer
+    from rest_framework.response import Response
+    from rest_framework.views import APIView
+
+
+    class ProfileList(APIView):
+        renderer_classes = [TemplateHTMLRenderer]
+        template_name = 'profile_list.html'
+
+        def get(self, request):
+            queryset = Profile.objects.all()
+            return Response({'profiles': queryset})
+
+**profile_list.html**:
+
+    <html><body>
+    <h1>Profiles</h1>
+    <ul>
+        {% for profile in profiles %}
         <li>{{ profile.name }}</li>
-        {% endfor %}
-    </ul>
-    </body></html>
-    
-## Rendering Forms
-
-Serializers may be rendered as forms by using the `render_form` template tag, and including the serializer instance as context to the template.
-
-The following view demonstrates an example of using a serializer in a template for viewing and updating a model instance:
-
-**views.py**:
-
-    from django.shortcuts import get_object_or_404
-    from my_project.example.models import Profile
-    from rest_framework.renderers import TemplateHTMLRenderer
-    from rest_framework.views import APIView
-
-
-    class ProfileDetail(APIView):
-        renderer_classes = [TemplateHTMLRenderer]
-        template_name = 'profile_detail.html'
-
-        def get(self, request, pk):
-            profile = get_object_or_404(Profile, pk=pk)
-            serializer = ProfileSerializer(profile)
-            return Response({'serializer': serializer, 'profile': profile})
-
-        def post(self, request, pk):
-            profile = get_object_or_404(Profile, pk=pk)
-            serializer = ProfileSerializer(profile)
-            if not serializer.is_valid():
-                return Response({'serializer': serializer, 'profile': profile})
            return redirect('profile-list')
-
-**profile_detail.html**:
-
-    {% load rest_framework %}
-
-    <html><body>
-    
-    <h1>Profile - {{ profile.name }}</h1>
-
-    <form action="{% url 'profile-detail' pk=profile.pk '%}" method="POST">
-        {% csrf_token %}
-        {% render_form serializer %}
-        <input type="submit" value="Save">
-    </form>
-
-    </body></html>
-
-### Using template packs
-
-The `render_form` tag takes an optional `template_pack` argument, that specifies which template directory should be used for rendering the form and form fields.
-
-REST framework includes three built-in template packs, all based on Bootstrap 3. The built-in styles are `horizontal`, `vertical`, and `inline`. The default style is `horizontal`. To use any of these template packs you'll want to also include the Bootstrap 3 CSS.
-
-The following HTML will link to a CDN hosted version of the Bootstrap 3 CSS:
-
-    <head>
-        …
-        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
-    </head>
-
-Third party packages may include alternate template packs, by bundling a template directory containing the necessary form and field templates.
-
-Let's take a look at how to render each of the three available template packs. For these examples we'll use a single serializer class to present a "Login" form.
-
-    class LoginSerializer(serializers.Serializer):
-        email = serializers.EmailField(
-            max_length=100,
-            style={'placeholder': 'Email'}
-        )
-        password = serializers.CharField(
-            max_length=100,
-            style={'input_type': 'password', 'placeholder': 'Password'}
-        )
-        remember_me = serializers.BooleanField()

---
-
-#### `rest_framework/vertical`
-
-Presents form labels above their corresponding control inputs, using the standard Bootstrap layout.
-
-*This is the default template pack.*
-
-    {% load rest_framework %}
-
-    ...
-
-    <form action="{% url 'login' %}" method="post" novalidate>
-        {% csrf_token %}
-        {% render_form serializer template_pack='rest_framework/vertical' %}
-        <button type="submit" class="btn btn-default">Sign in</button>
-    </form>
-
-![Vertical form example](../img/vertical.png)
-
----
-
#### `rest_framework/horizontal`
-
-Presents labels and controls alongside each other, using a 2/10 column split.
-
-*This is the form style used in the browsable API and admin renderers.*
-
-    {% load rest_framework %}
-
-    ...
-
-    <form class="form-horizontal" action="{% url 'login' %}" method="post" novalidate>
-        {% csrf_token %}
-        {% render_form serializer %}
-        <div class="form-group">
-            <div class="col-sm-offset-2 col-sm-10">
-                <button type="submit" class="btn btn-default">Sign in</button>
-            </div>
-        </div>
-    </form>
-
-![Horizontal form example](../img/horizontal.png)
-
----
-
-#### `rest_framework/inline`
-
-A compact form style that presents all the controls inline.
-
-    {% load rest_framework %}
-
-    ...
-
-    <form class="form-inline" action="{% url 'login' %}" method="post" novalidate>
-        {% csrf_token %}
-        {% render_form serializer template_pack='rest_framework/inline' %}
-        <button type="submit" class="btn btn-default">Sign in</button>
-    </form>
-
-![Inline form example](../img/inline.png)
-
-## Field styles
-
-Serializer fields can have their rendering style customized by using the `style` keyword argument. This argument is a dictionary of options that control the template and layout used.
-
-The most common way to customize the field style is to use the `base_template` style keyword argument to select which template in the template pack should be use.
-
-For example, to render a `CharField` as an HTML textarea rather than the default HTML input, you would use something like this:
-
-    details = serializers.CharField(
-        max_length=1000,
-        style={'base_template': 'textarea.html'}
-    )
-
-If you instead want a field to be rendered using a custom template that is *not part of an included template pack*, you can instead use the `template` style option, to fully specify a template name:
-
-    details = serializers.CharField(
-        max_length=1000,
-        style={'template': 'my-field-templates/custom-input.html'}
-    )
-
-Field templates can also use additional style properties, depending on their type. For example, the `textarea.html` template also accepts a `rows` property that can be used to affect the sizing of the control.
-
-    details = serializers.CharField(
-        max_length=1000,
-        style={'base_template': 'textarea.html', 'rows': 10}
-    )
-
-The complete list of `base_template` options and their associated style options is listed below.
-
-base_template  | Valid field types  | Additional style options     
-----|----|----
-input.html     | Any string, numeric or date/time field | input_type, placeholder, hide_label
-textarea.html |  `CharField` | rows, placeholder, hide_label
-select.html | `ChoiceField` or relational field types | hide_label
-radio.html | `ChoiceField` or relational field types | inline, hide_label
-select_multiple.html | `MultipleChoiceField` or relational fields with `many=True` | hide_label
-checkbox_multiple.html | `MultipleChoiceField` or relational fields with `many=True` | inline, hide_label
-checkbox.html | `BooleanField` | hide_label
-fieldset.html | Nested serializer | hide_label
-list_fieldset.html | `ListField` or nested serializer with `many=True` |   hide_label
+        {% endfor %}
+    </ul>
+    </body></html>
+    
+## Rendering Forms
+
+Serializers may be rendered as forms by using the `render_form` template tag, and including the serializer instance as context to the template.
+
+The following view demonstrates an example of using a serializer in a template for viewing and updating a model instance:
+
+**views.py**:
+
+    from django.shortcuts import get_object_or_404
+    from my_project.example.models import Profile
+    from rest_framework.renderers import TemplateHTMLRenderer
+    from rest_framework.views import APIView
+
+
+    class ProfileDetail(APIView):
+        renderer_classes = [TemplateHTMLRenderer]
+        template_name = 'profile_detail.html'
+
+        def get(self, request, pk):
+            profile = get_object_or_404(Profile, pk=pk)
+            serializer = ProfileSerializer(profile)
+            return Response({'serializer': serializer, 'profile': profile})
+
+        def post(self, request, pk):
+            profile = get_object_or_404(Profile, pk=pk)
+            serializer = ProfileSerializer(profile)
+            if not serializer.is_valid():
+                return Response({'serializer': serializer, 'profile': profile})
+            return redirect('profile-list')
+
+**profile_detail.html**:
+
+    {% load rest_framework %}
+
+    <html><body>
+    
+    <h1>Profile - {{ profile.name }}</h1>
+
+    <form action="{% url 'profile-detail' pk=profile.pk %}" method="POST">
+        {% csrf_token %}
+        {% render_form serializer %}
+        <input type="submit" value="Save">
+    </form>
+
+    </body></html>
+
+### Using template packs
+
+The `render_form` tag takes an optional `template_pack` argument, that specifies which template directory should be used for rendering the form and form fields.
+
+REST framework includes three built-in template packs, all based on Bootstrap 3. The built-in styles are `horizontal`, `vertical`, and `inline`. The default style is `horizontal`. To use any of these template packs you'll want to also include the Bootstrap 3 CSS.
+
+The following HTML will link to a CDN hosted version of the Bootstrap 3 CSS:
+
+    <head>
+        …
+        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
+    </head>
+
+Third party packages may include alternate template packs, by bundling a template directory containing the necessary form and field templates.
+
+Let's take a look at how to render each of the three available template packs. For these examples we'll use a single serializer class to present a "Login" form.
+
+    class LoginSerializer(serializers.Serializer):
+        email = serializers.EmailField(
+            max_length=100,
+            style={'placeholder': 'Email'}
+        )
+        password = serializers.CharField(
+            max_length=100,
+            style={'input_type': 'password', 'placeholder': 'Password'}
+        )
+        remember_me = serializers.BooleanField()
+
+---
+
+#### `rest_framework/vertical`
+
+Presents form labels above their corresponding control inputs, using the standard Bootstrap layout.
+
+*This is the default template pack.*
+
+    {% load rest_framework %}
+
+    ...
+
+    <form action="{% url 'login' %}" method="post" novalidate>
+        {% csrf_token %}
+        {% render_form serializer template_pack='rest_framework/vertical' %}
+        <button type="submit" class="btn btn-default">Sign in</button>
+    </form>
+
+![Vertical form example](../img/vertical.png)
+
+---
+
+#### `rest_framework/horizontal`
+
+Presents labels and controls alongside each other, using a 2/10 column split.
+
+*This is the form style used in the browsable API and admin renderers.*
+
+    {% load rest_framework %}
+
+    ...
+
+    <form class="form-horizontal" action="{% url 'login' %}" method="post" novalidate>
+        {% csrf_token %}
+        {% render_form serializer %}
+        <div class="form-group">
+            <div class="col-sm-offset-2 col-sm-10">
+                <button type="submit" class="btn btn-default">Sign in</button>
+            </div>
+        </div>
+    </form>
+
+![Horizontal form example](../img/horizontal.png)
+
+---
+
+#### `rest_framework/inline`
+
+A compact form style that presents all the controls inline.
+
+    {% load rest_framework %}
+
+    ...
+
+    <form class="form-inline" action="{% url 'login' %}" method="post" novalidate>
+        {% csrf_token %}
+        {% render_form serializer template_pack='rest_framework/inline' %}
+        <button type="submit" class="btn btn-default">Sign in</button>
+    </form>
+
+![Inline form example](../img/inline.png)
+
+## Field styles
+
+Serializer fields can have their rendering style customized by using the `style` keyword argument. This argument is a dictionary of options that control the template and layout used.
+
+The most common way to customize the field style is to use the `base_template` style keyword argument to select which template in the template pack should be use.
+
+For example, to render a `CharField` as an HTML textarea rather than the default HTML input, you would use something like this:
+
+    details = serializers.CharField(
+        max_length=1000,
+        style={'base_template': 'textarea.html'}
+    )
+
+If you instead want a field to be rendered using a custom template that is *not part of an included template pack*, you can instead use the `template` style option, to fully specify a template name:
+
+    details = serializers.CharField(
+        max_length=1000,
+        style={'template': 'my-field-templates/custom-input.html'}
+    )
+
+Field templates can also use additional style properties, depending on their type. For example, the `textarea.html` template also accepts a `rows` property that can be used to affect the sizing of the control.
+
+    details = serializers.CharField(
+        max_length=1000,
+        style={'base_template': 'textarea.html', 'rows': 10}
+    )
+
+The complete list of `base_template` options and their associated style options is listed below.
+
+base_template  | Valid field types  | Additional style options     
+----|----|----
+input.html     | Any string, numeric or date/time field | input_type, placeholder, hide_label
+textarea.html |  `CharField` | rows, placeholder, hide_label
+select.html | `ChoiceField` or relational field types | hide_label
+radio.html | `ChoiceField` or relational field types | inline, hide_label
+select_multiple.html | `MultipleChoiceField` or relational fields with `many=True` | hide_label
+checkbox_multiple.html | `MultipleChoiceField` or relational fields with `many=True` | inline, hide_label
+checkbox.html | `BooleanField` | hide_label
+fieldset.html | Nested serializer | hide_label
+list_fieldset.html | `ListField` or nested serializer with `many=True` |   hide_label
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index b901d9e..d21f8e5 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -40,6 +40,38 @@ You can determine your currently installed version using `pip freeze`:
 
 ## 3.3.x series
 
+### 3.3.2
+
+**Date**: [14th December 2015][3.3.2-milestone].
+
+* `ListField` enforces input is a list. ([#3513][gh3513])
+* Fix regression hiding raw data form. ([#3600][gh3600], [#3578][gh3578])
+* Fix Python 3.5 compatibility. ([#3534][gh3534], [#3626][gh3626])
+* Allow setting a custom Django Paginator in `pagination.PageNumberPagination`. ([#3631][gh3631], [#3684][gh3684])
+* Fix relational fields without `to_fields` attribute. ([#3635][gh3635], [#3634][gh3634])
+* Fix `template.render` deprecation warnings for Django 1.9. ([#3654][gh3654])
+* Sort response headers in browsable API renderer. ([#3655][gh3655])
+* Use related_objects api for Django 1.9+. ([#3656][gh3656], [#3252][gh3252])
+* Add confirm modal when deleting. ([#3228][gh3228], [#3662][gh3662])
+* Reveal previously hidden AttributeErrors and TypeErrors while calling has_[object_]permissions. ([#3668][gh3668])
+* Make DRF compatible with multi template engine in Django 1.8. ([#3672][gh3672])
+* Update `NestedBoundField` to also handle empty string when rendering its form. ([#3677][gh3677])
+* Fix UUID validation to properly catch invalid input types. ([#3687][gh3687], [#3679][gh3679])
+* Fix caching issues. ([#3628][gh3628], [#3701][gh3701])
+* Fix Admin and API browser for views without a filter_class. ([#3705][gh3705], [#3596][gh3596], [#3597][gh3597])
+* Add app_name to rest_framework.urls. ([#3714][gh3714])
+* Improve authtoken's views to support url versioning. ([#3718][gh3718], [#3723][gh3723])
+
+### 3.3.1
+
+**Date**: [4th November 2015][3.3.1-milestone].
+
+* Resolve parsing bug when accessing `request.POST` ([#3592][gh3592])
+* Correctly deal with `to_field` referring to primary key. ([#3593][gh3593])
+* Allow filter HTML to render when no `filter_class` is defined. ([#3560][gh3560])
+* Fix admin rendering issues. ([#3564][gh3564], [#3556][gh3556])
+* Fix issue with DecimalValidator. ([#3568][gh3568])
+
 ### 3.3.0
 
 **Date**: [28th October 2015][3.3.0-milestone].
@@ -336,6 +368,8 @@ For older release notes, [please see the version 2.x documentation][old-release-
 [3.2.4-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.2.4+Release%22
 [3.2.5-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.2.5+Release%22
 [3.3.0-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.3.0+Release%22
+[3.3.1-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.3.1+Release%22
+[3.3.2-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.3.2+Release%22
 
 <!-- 3.0.1 -->
 [gh2013]: https://github.com/tomchristie/django-rest-framework/issues/2013
@@ -578,3 +612,40 @@ For older release notes, [please see the version 2.x documentation][old-release-
 [gh3429]: https://github.com/tomchristie/django-rest-framework/issues/3429
 [gh3536]: https://github.com/tomchristie/django-rest-framework/issues/3536
 
+<!-- 3.3.1 -->
+[gh3556]: https://github.com/tomchristie/django-rest-framework/issues/3556
+[gh3560]: https://github.com/tomchristie/django-rest-framework/issues/3560
+[gh3564]: https://github.com/tomchristie/django-rest-framework/issues/3564
+[gh3568]: https://github.com/tomchristie/django-rest-framework/issues/3568
+[gh3592]: https://github.com/tomchristie/django-rest-framework/issues/3592
+[gh3593]: https://github.com/tomchristie/django-rest-framework/issues/3593
+
+<!-- 3.3.2 -->
+[gh3228]: https://github.com/tomchristie/django-rest-framework/issues/3228
+[gh3252]: https://github.com/tomchristie/django-rest-framework/issues/3252
+[gh3513]: https://github.com/tomchristie/django-rest-framework/issues/3513
+[gh3534]: https://github.com/tomchristie/django-rest-framework/issues/3534
+[gh3578]: https://github.com/tomchristie/django-rest-framework/issues/3578
+[gh3596]: https://github.com/tomchristie/django-rest-framework/issues/3596
+[gh3597]: https://github.com/tomchristie/django-rest-framework/issues/3597
+[gh3600]: https://github.com/tomchristie/django-rest-framework/issues/3600
+[gh3626]: https://github.com/tomchristie/django-rest-framework/issues/3626
+[gh3628]: https://github.com/tomchristie/django-rest-framework/issues/3628
+[gh3631]: https://github.com/tomchristie/django-rest-framework/issues/3631
+[gh3634]: https://github.com/tomchristie/django-rest-framework/issues/3634
+[gh3635]: https://github.com/tomchristie/django-rest-framework/issues/3635
+[gh3654]: https://github.com/tomchristie/django-rest-framework/issues/3654
+[gh3655]: https://github.com/tomchristie/django-rest-framework/issues/3655
+[gh3656]: https://github.com/tomchristie/django-rest-framework/issues/3656
+[gh3662]: https://github.com/tomchristie/django-rest-framework/issues/3662
+[gh3668]: https://github.com/tomchristie/django-rest-framework/issues/3668
+[gh3672]: https://github.com/tomchristie/django-rest-framework/issues/3672
+[gh3677]: https://github.com/tomchristie/django-rest-framework/issues/3677
+[gh3679]: https://github.com/tomchristie/django-rest-framework/issues/3679
+[gh3684]: https://github.com/tomchristie/django-rest-framework/issues/3684
+[gh3687]: https://github.com/tomchristie/django-rest-framework/issues/3687
+[gh3701]: https://github.com/tomchristie/django-rest-framework/issues/3701
+[gh3705]: https://github.com/tomchristie/django-rest-framework/issues/3705
+[gh3714]: https://github.com/tomchristie/django-rest-framework/issues/3714
+[gh3718]: https://github.com/tomchristie/django-rest-framework/issues/3718
+[gh3723]: https://github.com/tomchristie/django-rest-framework/issues/3723
diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md
index 887d1e5..8a9d73e 100644
--- a/docs/tutorial/4-authentication-and-permissions.md
+++ b/docs/tutorial/4-authentication-and-permissions.md
@@ -146,7 +146,7 @@ And, at the end of the file, add a pattern to include the login and logout views
                                    namespace='rest_framework')),
     ]
 
-The `r'^api-auth/'` part of pattern can actually be whatever URL you want to use.  The only restriction is that the included urls must use the `'rest_framework'` namespace.
+The `r'^api-auth/'` part of pattern can actually be whatever URL you want to use.  The only restriction is that the included urls must use the `'rest_framework'` namespace. In Django 1.9+, REST framework will set the namespace, so you may leave it out.
 
 Now if you open up the browser again and refresh the page you'll see a 'Login' link in the top right of the page.  If you log in as one of the users you created earlier, you'll be able to create code snippets again.
 
diff --git a/requirements/requirements-codestyle.txt b/requirements/requirements-codestyle.txt
index 1412a4d..2284a4c 100644
--- a/requirements/requirements-codestyle.txt
+++ b/requirements/requirements-codestyle.txt
@@ -3,4 +3,4 @@ flake8==2.4.0
 pep8==1.5.7
 
 # Sort and lint imports
-isort==3.9.6
+isort==4.2.2
diff --git a/requirements/requirements-packaging.txt b/requirements/requirements-packaging.txt
index 7510dbd..8f62ee3 100644
--- a/requirements/requirements-packaging.txt
+++ b/requirements/requirements-packaging.txt
@@ -5,4 +5,4 @@ wheel==0.24.0
 twine==1.4.0
 
 # Transifex client for managing translation resources.
-transifex-client==0.11b3
+transifex-client==0.11
diff --git a/rest_framework/__init__.py b/rest_framework/__init__.py
index d18b6d5..0e51999 100644
--- a/rest_framework/__init__.py
+++ b/rest_framework/__init__.py
@@ -8,7 +8,7 @@ ______ _____ _____ _____    __
 """
 
 __title__ = 'Django REST framework'
-__version__ = '3.3.1'
+__version__ = '3.3.2'
 __author__ = 'Tom Christie'
 __license__ = 'BSD 2-Clause'
 __copyright__ = 'Copyright 2011-2015 Tom Christie'
diff --git a/rest_framework/authtoken/views.py b/rest_framework/authtoken/views.py
index 7436840..0c6596a 100644
--- a/rest_framework/authtoken/views.py
+++ b/rest_framework/authtoken/views.py
@@ -12,7 +12,7 @@ class ObtainAuthToken(APIView):
     renderer_classes = (renderers.JSONRenderer,)
     serializer_class = AuthTokenSerializer
 
-    def post(self, request):
+    def post(self, request, *args, **kwargs):
         serializer = self.serializer_class(data=request.data)
         serializer.is_valid(raise_exception=True)
         user = serializer.validated_data['user']
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index 8b782a1..de8e77a 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -9,6 +9,7 @@ from __future__ import unicode_literals
 import django
 from django.conf import settings
 from django.db import connection, transaction
+from django.template import Context, RequestContext, Template
 from django.utils import six
 from django.views.generic import View
 
@@ -191,6 +192,7 @@ try:
 except ImportError:
     DecimalValidator = None
 
+
 def set_rollback():
     if hasattr(transaction, 'set_rollback'):
         if connection.settings_dict.get('ATOMIC_REQUESTS', False):
@@ -206,3 +208,54 @@ def set_rollback():
     else:
         # transaction not managed
         pass
+
+
+def template_render(template, context=None, request=None):
+    """
+    Passing Context or RequestContext to Template.render is deprecated in 1.9+,
+    see https://github.com/django/django/pull/3883 and
+    https://github.com/django/django/blob/1.9rc1/django/template/backends/django.py#L82-L84
+
+    :param template: Template instance
+    :param context: dict
+    :param request: Request instance
+    :return: rendered template as SafeText instance
+    """
+    if django.VERSION < (1, 8) or isinstance(template, Template):
+        if request:
+            context = RequestContext(request, context)
... 18622 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/djangorestframework.git



More information about the Python-modules-commits mailing list