Merge master

This commit is contained in:
Tom Christie 2014-10-31 15:19:15 +00:00
commit 159c3de9fc
8 changed files with 28 additions and 15 deletions

View File

@ -26,7 +26,7 @@ There is a live example API for testing purposes, [available here][sandbox].
# Requirements # 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.11+, 1.5.5+, 1.6, 1.7) * Django (1.4.11+, 1.5.5+, 1.6, 1.7)
# Installation # Installation

View File

@ -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. 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/ [cite]: http://jacobian.org/writing/rest-worst-practices/
[http401]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2 [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 [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 [hawk]: https://github.com/hueniverse/hawk
[mohawk]: http://mohawk.readthedocs.org/en/latest/ [mohawk]: http://mohawk.readthedocs.org/en/latest/
[mac]: http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05 [mac]: http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05
[djoser]: https://github.com/sunscrapers/djoser

View File

@ -49,7 +49,7 @@ Some reasons you might want to use REST framework:
REST framework requires the following: 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.11+, 1.5.5+, 1.6, 1.7) * Django (1.4.11+, 1.5.5+, 1.6, 1.7)
The following packages are optional: The following packages are optional:

View File

@ -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 [lts-releases]: https://docs.djangoproject.com/en/dev/internals/release-process/#long-term-support-lts-releases
[2-4-release-notes]: release-notes#240 [2-4-release-notes]: release-notes#240
[view-name-and-description-settings]: ../api-guide/settings/#view-names-and-descriptions [view-name-and-description-settings]: ../api-guide/settings#view-names-and-descriptions
[client-ip-identification]: ../api-guide/throttling/#how-clients-are-identified [client-ip-identification]: ../api-guide/throttling#how-clients-are-identified
[2-3-announcement]: 2.3-announcement [2-3-announcement]: 2.3-announcement
[github-labels]: https://github.com/tomchristie/django-rest-framework/issues [github-labels]: https://github.com/tomchristie/django-rest-framework/issues
[github-milestones]: https://github.com/tomchristie/django-rest-framework/milestones [github-milestones]: https://github.com/tomchristie/django-rest-framework/milestones

View File

@ -210,7 +210,9 @@ We recommend the [`django-reusable-app`][django-reusable-app] template as a good
## Linking to your package ## 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 [cite]: http://www.w3.org/People/Berners-Lee/FAQ.html
[code-of-conduct]: https://www.djangoproject.com/conduct/ [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 [docs]: https://github.com/tomchristie/django-rest-framework/tree/master/docs
[mou]: http://mouapp.com/ [mou]: http://mouapp.com/
[django-reusable-app]: https://github.com/dabapps/django-reusable-app [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/

View File

@ -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. * [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. * [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. * [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 ### Permissions

View File

@ -20,6 +20,7 @@ from collections import namedtuple
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import NoReverseMatch from django.core.urlresolvers import NoReverseMatch
from django.utils.datastructures import SortedDict
from rest_framework import views from rest_framework import views
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.reverse import reverse from rest_framework.reverse import reverse
@ -277,7 +278,7 @@ class DefaultRouter(SimpleRouter):
""" """
Return a view to use as the API root. Return a view to use as the API root.
""" """
api_root_dict = {} api_root_dict = SortedDict()
list_name = self.routes[0].name list_name = self.routes[0].name
for prefix, viewset, basename in self.registry: for prefix, viewset, basename in self.registry:
api_root_dict[prefix] = list_name.format(basename=basename) api_root_dict[prefix] = list_name.format(basename=basename)
@ -286,7 +287,7 @@ class DefaultRouter(SimpleRouter):
_ignore_model_permissions = True _ignore_model_permissions = True
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
ret = {} ret = SortedDict()
for key, url_name in api_root_dict.items(): for key, url_name in api_root_dict.items():
try: try:
ret[key] = reverse( ret[key] = reverse(

View File

@ -140,16 +140,16 @@
{% if post_form %} {% if post_form %}
<ul class="nav nav-tabs form-switcher"> <ul class="nav nav-tabs form-switcher">
<li> <li>
<a name='html-tab' href="#object-form" data-toggle="tab">HTML form</a> <a name='html-tab' href="#post-object-form" data-toggle="tab">HTML form</a>
</li> </li>
<li> <li>
<a name='raw-tab' href="#generic-content-form" data-toggle="tab">Raw data</a> <a name='raw-tab' href="#post-generic-content-form" data-toggle="tab">Raw data</a>
</li> </li>
</ul> </ul>
{% endif %} {% endif %}
<div class="well tab-content"> <div class="well tab-content">
{% if post_form %} {% if post_form %}
<div class="tab-pane" id="object-form"> <div class="tab-pane" id="post-object-form">
{% with form=post_form %} {% with form=post_form %}
<form action="{{ request.get_full_path }}" <form action="{{ request.get_full_path }}"
method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate> method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
@ -164,7 +164,7 @@
{% endwith %} {% endwith %}
</div> </div>
{% endif %} {% endif %}
<div {% if post_form %}class="tab-pane"{% endif %} id="generic-content-form"> <div {% if post_form %}class="tab-pane"{% endif %} id="post-generic-content-form">
{% with form=raw_data_post_form %} {% with form=raw_data_post_form %}
<form action="{{ request.get_full_path }}" method="POST" class="form-horizontal"> <form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
<fieldset> <fieldset>
@ -186,16 +186,16 @@
{% if put_form %} {% if put_form %}
<ul class="nav nav-tabs form-switcher"> <ul class="nav nav-tabs form-switcher">
<li> <li>
<a name='html-tab' href="#object-form" data-toggle="tab">HTML form</a> <a name='html-tab' href="#put-object-form" data-toggle="tab">HTML form</a>
</li> </li>
<li> <li>
<a name='raw-tab' href="#generic-content-form" data-toggle="tab">Raw data</a> <a name='raw-tab' href="#put-generic-content-form" data-toggle="tab">Raw data</a>
</li> </li>
</ul> </ul>
{% endif %} {% endif %}
<div class="well tab-content"> <div class="well tab-content">
{% if put_form %} {% if put_form %}
<div class="tab-pane" id="object-form"> <div class="tab-pane" id="put-object-form">
<form action="{{ request.get_full_path }}" <form action="{{ request.get_full_path }}"
method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate> method="POST" enctype="multipart/form-data" class="form-horizontal" novalidate>
<fieldset> <fieldset>
@ -209,7 +209,7 @@
</form> </form>
</div> </div>
{% endif %} {% endif %}
<div {% if put_form %}class="tab-pane"{% endif %} id="generic-content-form"> <div {% if put_form %}class="tab-pane"{% endif %} id="put-generic-content-form">
{% with form=raw_data_put_or_patch_form %} {% with form=raw_data_put_or_patch_form %}
<form action="{{ request.get_full_path }}" method="POST" class="form-horizontal"> <form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
<fieldset> <fieldset>