From 802913d5e4d40ee17054415bded02981055b651d Mon Sep 17 00:00:00 2001 From: "Anton D. Kachalov" Date: Fri, 26 Sep 2014 16:07:46 +0400 Subject: [PATCH 1/9] [templates/rest_framework/base.html] Separate `object-form' and `generic-content-form' IDs for POST and PUT forms Signed-off-by: Anton D. Kachalov --- .../templates/rest_framework/base.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index a84ccf269..3628daa0e 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -142,16 +142,16 @@ {% if post_form %} {% endif %}
{% if post_form %} -
+
{% with form=post_form %}
@@ -166,7 +166,7 @@ {% endwith %}
{% endif %} -
+
{% with form=raw_data_post_form %}
@@ -188,16 +188,16 @@ {% if put_form %} {% endif %}
{% if put_form %} -
+
@@ -211,7 +211,7 @@
{% endif %} -
+
{% with form=raw_data_put_or_patch_form %}
From 5734b6e20241c4d0d1441535657c5ef25302b225 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 29 Sep 2014 16:56:50 +0100 Subject: [PATCH 2/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63513f758..428fb8e9d 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ There is a live example API for testing purposes, [available here][sandbox]. # Requirements -* Python (2.6.5+, 2.7, 3.2, 3.3) +* Python (2.6.5+, 2.7, 3.2, 3.3, 3.4) * Django (1.4.2+, 1.5, 1.6, 1.7) # Installation From a8622adcd9f940131b63e91d53d2c49fcb89ee6a Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 29 Sep 2014 16:57:40 +0100 Subject: [PATCH 3/9] Update index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index e4c971f95..b18b71d20 100644 --- a/docs/index.md +++ b/docs/index.md @@ -49,7 +49,7 @@ Some reasons you might want to use REST framework: REST framework requires the following: -* Python (2.6.5+, 2.7, 3.2, 3.3) +* Python (2.6.5+, 2.7, 3.2, 3.3, 3.4) * Django (1.4.2+, 1.5, 1.6, 1.7) The following packages are optional: From 0803716ed034389a09305b7f037cb05d9ff5c57d Mon Sep 17 00:00:00 2001 From: Kevin London Date: Sat, 4 Oct 2014 17:34:27 -0700 Subject: [PATCH 4/9] Update links in 2.4-announcement.md The links to Django Rest Framework pages were 404ing because the URLs include a slash. --- docs/topics/2.4-announcement.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/topics/2.4-announcement.md b/docs/topics/2.4-announcement.md index 09294b910..8e4f3bb23 100644 --- a/docs/topics/2.4-announcement.md +++ b/docs/topics/2.4-announcement.md @@ -164,8 +164,8 @@ Once again, many thanks to all the generous [backers and sponsors][kickstarter-s [lts-releases]: https://docs.djangoproject.com/en/dev/internals/release-process/#long-term-support-lts-releases [2-4-release-notes]: release-notes#240 -[view-name-and-description-settings]: ../api-guide/settings/#view-names-and-descriptions -[client-ip-identification]: ../api-guide/throttling/#how-clients-are-identified +[view-name-and-description-settings]: ../api-guide/settings#view-names-and-descriptions +[client-ip-identification]: ../api-guide/throttling#how-clients-are-identified [2-3-announcement]: 2.3-announcement [github-labels]: https://github.com/tomchristie/django-rest-framework/issues [github-milestones]: https://github.com/tomchristie/django-rest-framework/milestones From 113a28ed8ad65d912180e8be7a92b679251b0249 Mon Sep 17 00:00:00 2001 From: konradhalas Date: Thu, 16 Oct 2014 13:48:18 +0200 Subject: [PATCH 5/9] Add djoser to authentication docs. --- docs/api-guide/authentication.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 0ec5bad10..b355012e1 100755 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -415,6 +415,10 @@ The [HawkREST][hawkrest] library builds on the [Mohawk][mohawk] library to let y HTTP Signature (currently a [IETF draft][http-signature-ietf-draft]) provides a way to achieve origin authentication and message integrity for HTTP messages. Similar to [Amazon's HTTP Signature scheme][amazon-http-signature], used by many of its services, it permits stateless, per-request authentication. [Elvio Toccalino][etoccalino] maintains the [djangorestframework-httpsignature][djangorestframework-httpsignature] package which provides an easy to use HTTP Signature Authentication mechanism. +## Djoser + +[Djoser][djoser] library provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. The package works with a custom user model and it uses token based authentication. This is a ready to use REST implementation of Django authentication system. + [cite]: http://jacobian.org/writing/rest-worst-practices/ [http401]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2 [http403]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4 @@ -449,3 +453,4 @@ HTTP Signature (currently a [IETF draft][http-signature-ietf-draft]) provides a [hawk]: https://github.com/hueniverse/hawk [mohawk]: http://mohawk.readthedocs.org/en/latest/ [mac]: http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05 +[djoser]: https://github.com/sunscrapers/djoser From 5e89994a10105b03b89abf0d0c9fee766942660e Mon Sep 17 00:00:00 2001 From: konradhalas Date: Thu, 16 Oct 2014 15:16:13 +0200 Subject: [PATCH 6/9] Add to main 3rd party resources list. --- docs/topics/third-party-resources.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/topics/third-party-resources.md b/docs/topics/third-party-resources.md index 1ca917427..0317dd64c 100644 --- a/docs/topics/third-party-resources.md +++ b/docs/topics/third-party-resources.md @@ -16,6 +16,7 @@ To submit new content, [open an issue](https://github.com/tomchristie/django-res * [djangorestframework-jwt](https://github.com/GetBlimp/django-rest-framework-jwt) - Provides JSON Web Token Authentication support. * [hawkrest](https://github.com/kumar303/hawkrest) - Provides Hawk HTTP Authorization. * [djangorestframework-httpsignature](https://github.com/etoccalino/django-rest-framework-httpsignature) - Provides an easy to use HTTP Signature Authentication mechanism. +* [djoser](https://github.com/sunscrapers/djoser) - Provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. ### Permissions From 11edd01c34debbe3b689da91efd63cddab7b28c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padilla?= Date: Fri, 17 Oct 2014 08:58:31 -0400 Subject: [PATCH 7/9] Add docs regarding linking third party packages --- docs/topics/contributing.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/topics/contributing.md b/docs/topics/contributing.md index 3400bc8f9..4fafb1b1e 100644 --- a/docs/topics/contributing.md +++ b/docs/topics/contributing.md @@ -210,7 +210,9 @@ We recommend the [`django-reusable-app`][django-reusable-app] template as a good ## Linking to your package -Once your package is decently documented and available on PyPI open a pull request or issue, and we'll add a link to it from the main REST framework documentation. +Once your package is decently documented and available on PyPI open a pull request or issue, and we'll add a link to it from the main REST framework documentation. You can add your package under **Third party packages** of the API Guide section that best applies, like [Authentication][authentication] or [Permissions][permissions]. You can also link your package under the [Third Party Resources][third-party-resources] section. + +We also suggest adding it to the [REST Framework][rest-framework-grid] grid on Django Packages. [cite]: http://www.w3.org/People/Berners-Lee/FAQ.html [code-of-conduct]: https://www.djangoproject.com/conduct/ @@ -225,3 +227,7 @@ Once your package is decently documented and available on PyPI open a pull reque [docs]: https://github.com/tomchristie/django-rest-framework/tree/master/docs [mou]: http://mouapp.com/ [django-reusable-app]: https://github.com/dabapps/django-reusable-app +[authentication]: ../api-guide/authentication.md +[permissions]: ../api-guide/permissions.md +[third-party-resources]: third-party-resources.md +[rest-framework-grid]: https://www.djangopackages.com/grids/g/django-rest-framework/ From 12b677039d5485afa7bc913a6f56c4b107fbbe3f Mon Sep 17 00:00:00 2001 From: Erik Wickstrom Date: Sun, 19 Oct 2014 21:03:33 -0700 Subject: [PATCH 8/9] Maintain order of views on router for api root view. --- rest_framework/routers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rest_framework/routers.py b/rest_framework/routers.py index f2d062118..9937566d2 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -16,7 +16,7 @@ For example, you might have a `urls.py` that looks something like this: from __future__ import unicode_literals import itertools -from collections import namedtuple +from collections import namedtuple, OrderedDict from django.conf.urls import patterns, url from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import NoReverseMatch @@ -277,7 +277,7 @@ class DefaultRouter(SimpleRouter): """ Return a view to use as the API root. """ - api_root_dict = {} + api_root_dict = OrderedDict() list_name = self.routes[0].name for prefix, viewset, basename in self.registry: api_root_dict[prefix] = list_name.format(basename=basename) @@ -286,7 +286,7 @@ class DefaultRouter(SimpleRouter): _ignore_model_permissions = True def get(self, request, *args, **kwargs): - ret = {} + ret = OrderedDict() for key, url_name in api_root_dict.items(): try: ret[key] = reverse( From 674855a114cca8afbcd7a9927170d0d420aea819 Mon Sep 17 00:00:00 2001 From: Erik Wickstrom Date: Mon, 20 Oct 2014 08:47:45 -0700 Subject: [PATCH 9/9] Used Django utils SortedDict instead of stdlib's OrderedDict for wider compatability. --- rest_framework/routers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 9937566d2..169e6e8bc 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -16,10 +16,11 @@ For example, you might have a `urls.py` that looks something like this: from __future__ import unicode_literals import itertools -from collections import namedtuple, OrderedDict +from collections import namedtuple from django.conf.urls import patterns, url from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import NoReverseMatch +from django.utils.datastructures import SortedDict from rest_framework import views from rest_framework.response import Response from rest_framework.reverse import reverse @@ -277,7 +278,7 @@ class DefaultRouter(SimpleRouter): """ Return a view to use as the API root. """ - api_root_dict = OrderedDict() + api_root_dict = SortedDict() list_name = self.routes[0].name for prefix, viewset, basename in self.registry: api_root_dict[prefix] = list_name.format(basename=basename) @@ -286,7 +287,7 @@ class DefaultRouter(SimpleRouter): _ignore_model_permissions = True def get(self, request, *args, **kwargs): - ret = OrderedDict() + ret = SortedDict() for key, url_name in api_root_dict.items(): try: ret[key] = reverse(