-
The team behind REST framework are launching a new API service.
+
The team behind REST framework is launching a new API service.
If you want to be first in line when we start issuing invitations, please sign up here:
--
cgit v1.2.3
From e80b353085c460c5ab7e9b4d22249f01176c5eb1 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 9 Dec 2013 08:10:51 +0000
Subject: Add notes to contributing docs
---
docs/topics/contributing.md | 3 +++
1 file changed, 3 insertions(+)
(limited to 'docs')
diff --git a/docs/topics/contributing.md b/docs/topics/contributing.md
index 2b18c4f6..4dd2718f 100644
--- a/docs/topics/contributing.md
+++ b/docs/topics/contributing.md
@@ -33,6 +33,8 @@ Some tips on good issue reporting:
* When describing issues try to phrase your ticket in terms of the *behavior* you think needs changing rather than the *code* you think need changing.
* Search the issue list first for related items, and make sure you're running the latest version of REST framework before reporting an issue.
* If reporting a bug, then try to include a pull request with a failing test case. This will help us quickly identify if there is a valid issue, and make sure that it gets fixed more quickly if there is one.
+* Feature requests will often be closed with a recommendation that they be implemented outside of the core REST framework library. Keeping new feature requests implemented as third party libraries allows us to keep down the maintainence overhead of REST framework, so that the focus can be on continued stability, bugfixes, and great documentation.
+* Closing an issue doesn't necessarily mean the end of a discussion. If you believe your issue has been closed incorrectly, explain why and we'll consider if it needs to be reopened.
## Triaging issues
@@ -42,6 +44,7 @@ Getting involved in triaging incoming issues is a good way to start contributing
* Is the ticket reported in the correct place, would it be better suited as a discussion on the discussion group?
* If the ticket is a bug report, can you reproduce it? Are you able to write a failing test case that demonstrates the issue and that can be submitted as a pull request?
* If the ticket is a feature request, do you agree with it, and could the feature request instead be implemented as a third party package?
+* If a ticket hasn't had much activity and it addresses something you need, then comment on the ticket and try to find out what's needed to get it moving again.
# Development
--
cgit v1.2.3
From 23369650e3502305ebf5d682e141c7d47db89111 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 9 Dec 2013 08:14:21 +0000
Subject: Add notes to contributing docs
---
docs/topics/contributing.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/topics/contributing.md b/docs/topics/contributing.md
index 4dd2718f..b3ab52bb 100644
--- a/docs/topics/contributing.md
+++ b/docs/topics/contributing.md
@@ -10,7 +10,7 @@ There are many ways you can contribute to Django REST framework. We'd like it t
The most important thing you can do to help push the REST framework project forward is to be actively involved wherever possible. Code contributions are often overvalued as being the primary way to get involved in a project, we don't believe that needs to be the case.
-If you use REST framework, we'd love you to be vocal about your experiances with it - you might consider writing a blog post on your experience with using REST framework, or publishing a tutorial about using the project with a particular javascript framework. Experiances from beginners can be particularly helpful because you'll be in the best position to assess which bits of REST framework are and aren't easy to understand and work with.
+If you use REST framework, we'd love you to be vocal about your experiences with it - you might consider writing a blog post about using REST framework, or publishing a tutorial about building a project with a particularJjavascript framework. Experiences from beginners can be particularly helpful because you'll be in the best position to assess which bits of REST framework are more difficult to understand and work with.
Other really great ways you can help move the community forward include helping answer questions on the [discussion group][google-group], or setting up an [email alert on StackOverflow][so-filter] so that you get notified of any new questions with the `django-rest-framework` tag.
--
cgit v1.2.3
From e6f6bb5c7e3e882b0215c981e2f2b6a576820100 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 9 Dec 2013 08:42:09 +0000
Subject: Add notes to contributing docs
---
docs/topics/contributing.md | 11 +++++++++++
1 file changed, 11 insertions(+)
(limited to 'docs')
diff --git a/docs/topics/contributing.md b/docs/topics/contributing.md
index b3ab52bb..77c60fb4 100644
--- a/docs/topics/contributing.md
+++ b/docs/topics/contributing.md
@@ -164,6 +164,16 @@ If you want to draw attention to a note or warning, use a pair of enclosing line
---
+## Third party packages
+
+New features to REST framework are generally recommended to be implemented as third party libraries that are developed outside of the core framework. Ideally third party libraries should be properly documented and packaged, and made available on PyPI.
+
+If you have some functionality that you would like to implement as a third party package it's worth contacting the [discussion group][google-group] as others may be willing to get involved. We strongly encourage third party package development and will always try to prioritize time spent helping their development, documentation and packaging.
+
+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 documentation.
+
+We recommend the [`django-reusable-app`][django-reusable-app] template as a good resource for getting up and running with implementing a third party Django package.
+
[cite]: http://www.w3.org/People/Berners-Lee/FAQ.html
[code-of-conduct]: https://www.djangoproject.com/conduct/
[google-group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework
@@ -176,3 +186,4 @@ If you want to draw attention to a note or warning, use a pair of enclosing line
[markdown]: http://daringfireball.net/projects/markdown/basics
[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
--
cgit v1.2.3
From c1be503308e755d72aae2c9695739bd33631e18b Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 9 Dec 2013 08:46:18 +0000
Subject: Add notes to contributing docs
---
docs/topics/contributing.md | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
(limited to 'docs')
diff --git a/docs/topics/contributing.md b/docs/topics/contributing.md
index 77c60fb4..906950bb 100644
--- a/docs/topics/contributing.md
+++ b/docs/topics/contributing.md
@@ -164,16 +164,20 @@ If you want to draw attention to a note or warning, use a pair of enclosing line
---
-## Third party packages
+# Third party packages
New features to REST framework are generally recommended to be implemented as third party libraries that are developed outside of the core framework. Ideally third party libraries should be properly documented and packaged, and made available on PyPI.
-If you have some functionality that you would like to implement as a third party package it's worth contacting the [discussion group][google-group] as others may be willing to get involved. We strongly encourage third party package development and will always try to prioritize time spent helping their development, documentation and packaging.
+## Getting started
-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 documentation.
+If you have some functionality that you would like to implement as a third party package it's worth contacting the [discussion group][google-group] as others may be willing to get involved. We strongly encourage third party package development and will always try to prioritize time spent helping their development, documentation and packaging.
We recommend the [`django-reusable-app`][django-reusable-app] template as a good resource for getting up and running with implementing a third party Django 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.
+
[cite]: http://www.w3.org/People/Berners-Lee/FAQ.html
[code-of-conduct]: https://www.djangoproject.com/conduct/
[google-group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework
--
cgit v1.2.3
From 2c898bd9018e40a8d0e4718fb2a0e3672e64782c Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 9 Dec 2013 09:27:10 +0000
Subject: Update release notes
---
docs/topics/release-notes.md | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'docs')
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index b080ad43..d3f85e6e 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`:
## 2.3.x series
+### Master
+
+* JSON renderer now deals with objects that implement a dict-like interface.
+
### 2.3.10
**Date**: 6th December 2013
--
cgit v1.2.3
From de319f3e28d27d71fffce7c8f12c23363d5c25eb Mon Sep 17 00:00:00 2001
From: Ian
Date: Mon, 9 Dec 2013 09:53:16 +0000
Subject: Fix typo "Not" -> "Note"
---
docs/api-guide/serializers.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md
index 4c3fb9d3..6fc25f57 100644
--- a/docs/api-guide/serializers.md
+++ b/docs/api-guide/serializers.md
@@ -425,7 +425,7 @@ You can change the field that is used for object lookups by setting the `lookup_
fields = ('url', 'account_name', 'users', 'created')
lookup_field = 'slug'
-Not that the `lookup_field` will be used as the default on *all* hyperlinked fields, including both the URL identity, and any hyperlinked relationships.
+Note that the `lookup_field` will be used as the default on *all* hyperlinked fields, including both the URL identity, and any hyperlinked relationships.
For more specific requirements such as specifying a different lookup for each field, you'll want to set the fields on the serializer explicitly. For example:
--
cgit v1.2.3
From 9ba7be959c2a2fea989527c590ce833df5925e63 Mon Sep 17 00:00:00 2001
From: Maxim Kamenkov
Date: Mon, 9 Dec 2013 20:33:06 +0200
Subject: Added REST Condition to 3rd party permissions packages list.
---
docs/api-guide/permissions.md | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'docs')
diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md
index 871de84e..60624b63 100644
--- a/docs/api-guide/permissions.md
+++ b/docs/api-guide/permissions.md
@@ -230,6 +230,10 @@ The [DRF Any Permissions][drf-any-permissions] packages provides a different per
The [Composed Permissions][composed-permissions] package provides a simple way to define complex and multi-depth (with logic operators) permission objects, using small and reusable components.
+## REST Condition
+
+The [REST Condition][rest-condition] yet another but simple and convenient extension for complex permissions tree. The extension allows to combine permissions with logical operators rules. Logical expressions can be used along with the usual permissions classes in api views.
+
[cite]: https://developer.apple.com/library/mac/#documentation/security/Conceptual/AuthenticationAndAuthorizationGuide/Authorization/Authorization.html
[authentication]: authentication.md
[throttling]: throttling.md
@@ -243,3 +247,4 @@ The [Composed Permissions][composed-permissions] package provides a simple way t
[filtering]: filtering.md
[drf-any-permissions]: https://github.com/kevin-brown/drf-any-permissions
[composed-permissions]: https://github.com/niwibe/djangorestframework-composed-permissions
+[rest-condition]: https://github.com/caxap/rest_condition
--
cgit v1.2.3
From 785a42cd5aee9e96f9b780ff144fa13c16189748 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Tue, 10 Dec 2013 08:38:43 +0000
Subject: Tweak REST condition text.
---
docs/api-guide/permissions.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md
index 60624b63..6a0f48f4 100644
--- a/docs/api-guide/permissions.md
+++ b/docs/api-guide/permissions.md
@@ -232,7 +232,7 @@ The [Composed Permissions][composed-permissions] package provides a simple way t
## REST Condition
-The [REST Condition][rest-condition] yet another but simple and convenient extension for complex permissions tree. The extension allows to combine permissions with logical operators rules. Logical expressions can be used along with the usual permissions classes in api views.
+The [REST Condition][rest-condition] package is another extension for building complex permissions in a simple and convenient way. The extension allows you to combine permissions with logical operators.
[cite]: https://developer.apple.com/library/mac/#documentation/security/Conceptual/AuthenticationAndAuthorizationGuide/Authorization/Authorization.html
[authentication]: authentication.md
--
cgit v1.2.3
From 40164fcc6241489033d7015d429cbe0afc674d37 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Tue, 10 Dec 2013 08:49:54 +0000
Subject: Update release notes
---
docs/topics/release-notes.md | 1 +
1 file changed, 1 insertion(+)
(limited to 'docs')
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index d3f85e6e..e186893e 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -43,6 +43,7 @@ You can determine your currently installed version using `pip freeze`:
### Master
* JSON renderer now deals with objects that implement a dict-like interface.
+* Bugfix: Refine behavior that call's model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
### 2.3.10
--
cgit v1.2.3
From c09ad1bedc8559b2e6eadf0e5b8f3732af2d9d29 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Tue, 10 Dec 2013 08:53:38 +0000
Subject: Remove incorrect apostrophe
---
docs/topics/release-notes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index e186893e..1ddd8351 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -43,7 +43,7 @@ You can determine your currently installed version using `pip freeze`:
### Master
* JSON renderer now deals with objects that implement a dict-like interface.
-* Bugfix: Refine behavior that call's model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
+* Bugfix: Refine behavior that calls model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
### 2.3.10
--
cgit v1.2.3
From 7382f8c6adc17c9feb02d028f7791af632d6dd3b Mon Sep 17 00:00:00 2001
From: David Ray
Date: Tue, 10 Dec 2013 14:56:07 -0500
Subject: Update routers.md
Reference to ```DefaultRouter``` should be ```SimpleRouter```---
docs/api-guide/routers.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index fb48197e..8151e60f 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -12,7 +12,7 @@ REST framework adds support for automatic URL routing to Django, and provides yo
## Usage
-Here's an example of a simple URL conf, that uses `DefaultRouter`.
+Here's an example of a simple URL conf, that uses `SimpleRouter`.
from rest_framework import routers
--
cgit v1.2.3
From 5acefd3b17e498af756fa48e27d7f8ce19322c7a Mon Sep 17 00:00:00 2001
From: OddBloke
Date: Wed, 11 Dec 2013 13:55:54 +0000
Subject: Add full required imports to Generating Tokens example
Previously we were missing User and post_save.---
docs/api-guide/authentication.md | 2 ++
1 file changed, 2 insertions(+)
(limited to 'docs')
diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md
index 1a1c68b8..ef77e02c 100755
--- a/docs/api-guide/authentication.md
+++ b/docs/api-guide/authentication.md
@@ -162,6 +162,8 @@ The `curl` command line tool may be useful for testing token authenticated APIs.
If you want every user to have an automatically generated Token, you can simply catch the User's `post_save` signal.
+ from django.contrib.auth.models import User
+ from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
--
cgit v1.2.3
From 4f473f0b9e918f2e071da0c84bd9b584c00ac919 Mon Sep 17 00:00:00 2001
From: OddBloke
Date: Wed, 11 Dec 2013 13:56:56 +0000
Subject: Use get_user_model instead of User in Generating Tokens example
Because that's a better way of doing it.---
docs/api-guide/authentication.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'docs')
diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md
index ef77e02c..53efc49a 100755
--- a/docs/api-guide/authentication.md
+++ b/docs/api-guide/authentication.md
@@ -162,12 +162,12 @@ The `curl` command line tool may be useful for testing token authenticated APIs.
If you want every user to have an automatically generated Token, you can simply catch the User's `post_save` signal.
- from django.contrib.auth.models import User
+ from django.contrib.auth import get_user_model
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
- @receiver(post_save, sender=User)
+ @receiver(post_save, sender=get_user_model())
def create_auth_token(sender, instance=None, created=False, **kwargs):
if created:
Token.objects.create(user=instance)
--
cgit v1.2.3
From df2d9034c2a5a07dc3aa5455db892ee94cbed467 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Thu, 12 Dec 2013 23:10:31 +0000
Subject: Add third party packages
---
docs/api-guide/filtering.md | 9 +++++++++
docs/api-guide/routers.md | 9 +++++++++
2 files changed, 18 insertions(+)
(limited to 'docs')
diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md
index a0132ffc..0e02a2a7 100644
--- a/docs/api-guide/filtering.md
+++ b/docs/api-guide/filtering.md
@@ -360,6 +360,14 @@ For example, you might need to restrict users to only being able to see objects
We could achieve the same behavior by overriding `get_queryset()` on the views, but using a filter backend allows you to more easily add this restriction to multiple views, or to apply it across the entire API.
+# Third party packages
+
+The following third party packages provide additional filter implementations.
+
+## Django REST framework chain
+
+The [django-rest-framework-chain package][django-rest-framework-chain] works together with the `DjangoFilterBackend` class, and allows you to easily create filters across relationships, or create multiple filter lookup types for a given field.
+
[cite]: https://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters
[django-filter]: https://github.com/alex/django-filter
[django-filter-docs]: https://django-filter.readthedocs.org/en/latest/index.html
@@ -368,3 +376,4 @@ We could achieve the same behavior by overriding `get_queryset()` on the views,
[view-permissions-blogpost]: http://blog.nyaruka.com/adding-a-view-permission-to-django-models
[nullbooleanselect]: https://github.com/django/django/blob/master/django/forms/widgets.py
[search-django-admin]: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.search_fields
+[django-rest-framework-chain]: https://github.com/philipn/django-rest-framework-chain
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 8151e60f..9001b859 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -150,4 +150,13 @@ If you want to provide totally custom behavior, you can override `BaseRouter` an
You may also want to override the `get_default_base_name(self, viewset)` method, or else always explicitly set the `base_name` argument when registering your viewsets with the router.
+# Third Party Packages
+
+The following third party packages provide router implementations that extend the default functionality provided by REST framework.
+
+## DRF Nested Routers
+
+The [drf-nested-routers package][drf-nested-routers] provides routers and relationship fields for working with nested resources.
+
[cite]: http://guides.rubyonrails.org/routing.html
+[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers
--
cgit v1.2.3
From 83da4949c099fcf7e7636c98b9052b502e1bf74b Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 13 Dec 2013 00:02:18 +0000
Subject: Allow NUM_PROXIES=0 and include more docs
---
docs/api-guide/settings.md | 6 ++++++
docs/api-guide/throttling.md | 18 ++++++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
(limited to 'docs')
diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md
index 13f96f9a..d8c878ff 100644
--- a/docs/api-guide/settings.md
+++ b/docs/api-guide/settings.md
@@ -359,5 +359,11 @@ The name of a parameter in the URL conf that may be used to provide a format suf
Default: `'format'`
+#### NUM_PROXIES
+
+An integer of 0 or more, that may be used to specify the number of application proxies that the API runs behind. This allows throttling to more accurately identify client IP addresses. If set to `None` then less strict IP matching will be used by the throttle classes.
+
+Default: `None`
+
[cite]: http://www.python.org/dev/peps/pep-0020/
[strftime]: http://docs.python.org/2/library/time.html#time.strftime
diff --git a/docs/api-guide/throttling.md b/docs/api-guide/throttling.md
index 34418e84..b2a5bb19 100644
--- a/docs/api-guide/throttling.md
+++ b/docs/api-guide/throttling.md
@@ -35,16 +35,11 @@ The default throttling policy may be set globally, using the `DEFAULT_THROTTLE_C
'DEFAULT_THROTTLE_RATES': {
'anon': '100/day',
'user': '1000/day'
- },
- 'NUM_PROXIES': 2,
+ }
}
The rate descriptions used in `DEFAULT_THROTTLE_RATES` may include `second`, `minute`, `hour` or `day` as the throttle period.
-By default Django REST Framework will try to use the `HTTP_X_FORWARDED_FOR` header to uniquely identify client machines for throttling. If `HTTP_X_FORWARDED_FOR` is not present `REMOTE_ADDR` header value will be used.
-
-To help Django REST Framework identify unique clients the number of application proxies can be set using `NUM_PROXIES`. This setting will allow the throttle to correctly identify unique requests when there are multiple application side proxies in front of the server. `NUM_PROXIES` should be set to an integer. It is important to understand that if you configure `NUM_PROXIES > 0` all clients behind a unique [NAT'd](http://en.wikipedia.org/wiki/Network_address_translation) gateway will be treated as a single client.
-
You can also set the throttling policy on a per-view or per-viewset basis,
using the `APIView` class based views.
@@ -71,6 +66,16 @@ Or, if you're using the `@api_view` decorator with function based views.
}
return Response(content)
+## How clients are identified
+
+By default the `X-Forwarded-For` HTTP header is used to uniquely identify client machines for throttling. If the `X-Forwarded-For` header is not present, then the value of the `Remote-Addr` header will be used.
+
+If you need to more strictly identify unique clients, you'll need to configure the number of application proxies that the API runs behind by setting the `NUM_PROXIES` setting. This setting should be an integer of 0 or more, and will allow the throttle to identify the client IP as being the last IP address in the `X-Forwarded-For` header, once any application proxy IP addresses have first been excluded.
+
+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.
+
+Further context on how the `X-Forwarded-For` header works, and identifier a remote client IP can be [found here][identifing-clients].
+
## Setting up the cache
The throttle classes provided by REST framework use Django's cache backend. You should make sure that you've set appropriate [cache settings][cache-setting]. The default value of `LocMemCache` backend should be okay for simple setups. See Django's [cache documentation][cache-docs] for more details.
@@ -183,5 +188,6 @@ The following is an example of a rate throttle, that will randomly throttle 1 in
[cite]: https://dev.twitter.com/docs/error-codes-responses
[permissions]: permissions.md
+[identifing-clients]: http://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#Multiple_Proxies_in_front_of_the_cluster
[cache-setting]: https://docs.djangoproject.com/en/dev/ref/settings/#caches
[cache-docs]: https://docs.djangoproject.com/en/dev/topics/cache/#setting-up-the-cache
--
cgit v1.2.3
From ed931b90ae9e72f963673e6e188b1802a5a65360 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 13 Dec 2013 00:11:59 +0000
Subject: Further docs tweaks
---
docs/api-guide/throttling.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'docs')
diff --git a/docs/api-guide/throttling.md b/docs/api-guide/throttling.md
index b2a5bb19..536f0ab7 100644
--- a/docs/api-guide/throttling.md
+++ b/docs/api-guide/throttling.md
@@ -68,13 +68,13 @@ Or, if you're using the `@api_view` decorator with function based views.
## How clients are identified
-By default the `X-Forwarded-For` HTTP header is used to uniquely identify client machines for throttling. If the `X-Forwarded-For` header is not present, then the value of the `Remote-Addr` header will be used.
+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.
-If you need to more strictly identify unique clients, you'll need to configure the number of application proxies that the API runs behind by setting the `NUM_PROXIES` setting. This setting should be an integer of 0 or more, and will allow the throttle to identify the client IP as being the last IP address in the `X-Forwarded-For` header, once any application proxy IP addresses have first been excluded.
+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.
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.
-Further context on how the `X-Forwarded-For` header works, and identifier a remote client IP can be [found here][identifing-clients].
+Further context on how the `X-Forwarded-For` header works, and identifing a remote client IP can be [found here][identifing-clients].
## Setting up the cache
--
cgit v1.2.3
From 73e8536e0d38f6677ac30aa2b3ba80563961191f Mon Sep 17 00:00:00 2001
From: S. Andrew Sheppard
Date: Thu, 12 Dec 2013 21:45:44 -0600
Subject: third-party package: wq.db
---
docs/api-guide/routers.md | 14 ++++++++++++++
1 file changed, 14 insertions(+)
(limited to 'docs')
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 8151e60f..ed903114 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -150,4 +150,18 @@ If you want to provide totally custom behavior, you can override `BaseRouter` an
You may also want to override the `get_default_base_name(self, viewset)` method, or else always explicitly set the `base_name` argument when registering your viewsets with the router.
+# Third party packages
+
+The following third party packages are also available.
+
+## wq.db
+
+[wq.db] provides an advanced [Router][wq.db-router] class (and singleton instance) that extends `DefaultRouter` with a `register_model()` API. Much like Django's `admin.site.register`, the only required argument to `app.router.register_model` is a model class. Reasonable defaults for a url prefix and viewset will be inferred from the model and global configuration.
+
+ from wq.db.rest import app
+ from .models import MyModel
+ app.router.register_model(MyModel)
+
[cite]: http://guides.rubyonrails.org/routing.html
+[wq.db]: http://wq.io/wq.db
+[wq.db-router]: http://wq.io/docs/app.py
--
cgit v1.2.3
From ca244ad614e2f6fb4fef1dc9987be996d2624303 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 13 Dec 2013 15:30:59 +0000
Subject: Expanded notes in quickstart. Closes #1127. Closes #1128.
---
docs/index.md | 2 +-
docs/tutorial/quickstart.md | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/index.md b/docs/index.md
index badd6f60..04804fa7 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -112,7 +112,7 @@ Here's our project's root `urls.py` module:
model = Group
- # Routers provide an easy way of automatically determining the URL conf
+ # Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'groups', GroupViewSet)
diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md
index 80bb9abb..8bf8c7f5 100644
--- a/docs/tutorial/quickstart.md
+++ b/docs/tutorial/quickstart.md
@@ -89,6 +89,10 @@ Rather than write multiple views we're grouping together all the common behavior
We can easily break these down into individual views if we need to, but using viewsets keeps the view logic nicely organized as well as being very concise.
+Notice that our viewset classes here are a little different from those in the [frontpage example][readme-example-api], as they include `queryset` and `serializer_class` attributes, instead of a `model` attribute.
+
+For trivial cases you can simply set a `model` attribute on the `ViewSet` class and the serializer and queryset will be automatically generated for you. Setting the `queryset` and/or `serializer_class` attributes gives you more explicit control of the API behaviour, and is the recommended style for most applications.
+
## URLs
Okay, now let's wire up the API URLs. On to `tutorial/urls.py`...
@@ -169,6 +173,7 @@ Great, that was easy!
If you want to get a more in depth understanding of how REST framework fits together head on over to [the tutorial][tutorial], or start browsing the [API guide][guide].
+[readme-example-api]: ../#example
[image]: ../img/quickstart.png
[tutorial]: 1-serialization.md
[guide]: ../#api-guide
--
cgit v1.2.3
From 87b99d1ac8ce212dd0751f597e3279d80d4fcad1 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 13 Dec 2013 20:17:26 +0000
Subject: Update release notes
---
docs/topics/release-notes.md | 1 +
1 file changed, 1 insertion(+)
(limited to 'docs')
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index 1ddd8351..54865053 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -44,6 +44,7 @@ You can determine your currently installed version using `pip freeze`:
* JSON renderer now deals with objects that implement a dict-like interface.
* Bugfix: Refine behavior that calls model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
+* Bugfix: Allow defaults on BooleanFields to be properly honored when values are not supplied.
### 2.3.10
--
cgit v1.2.3
From 39dbea4da43f829863d395d5f2ee158837f2afe2 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 13 Dec 2013 20:27:17 +0000
Subject: Links to drf-nested-routers
---
docs/api-guide/relations.md | 11 +++++++++++
docs/api-guide/routers.md | 4 +---
2 files changed, 12 insertions(+), 3 deletions(-)
(limited to 'docs')
diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md
index 556429bb..1b089c54 100644
--- a/docs/api-guide/relations.md
+++ b/docs/api-guide/relations.md
@@ -442,7 +442,18 @@ In the 2.4 release, these parts of the API will be removed entirely.
For more details see the [2.2 release announcement][2.2-announcement].
+---
+
+# Third Party Packages
+
+The following third party packages are also available.
+
+## DRF Nested Routers
+
+The [drf-nested-routers package][drf-nested-routers] provides routers and relationship fields for working with nested resources.
+
[cite]: http://lwn.net/Articles/193245/
[reverse-relationships]: https://docs.djangoproject.com/en/dev/topics/db/queries/#following-relationships-backward
[generic-relations]: https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1
[2.2-announcement]: ../topics/2.2-announcement.md
+[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 54fae65f..895589db 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -158,9 +158,6 @@ The following third party packages are also available.
The [drf-nested-routers package][drf-nested-routers] provides routers and relationship fields for working with nested resources.
-[cite]: http://guides.rubyonrails.org/routing.html
-[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers
-
## wq.db
The [wq.db package][wq.db] provides an advanced [Router][wq.db-router] class (and singleton instance) that extends `DefaultRouter` with a `register_model()` API. Much like Django's `admin.site.register`, the only required argument to `app.router.register_model` is a model class. Reasonable defaults for a url prefix and viewset will be inferred from the model and global configuration.
@@ -171,5 +168,6 @@ The [wq.db package][wq.db] provides an advanced [Router][wq.db-router] class (an
app.router.register_model(MyModel)
[cite]: http://guides.rubyonrails.org/routing.html
+[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers
[wq.db]: http://wq.io/wq.db
[wq.db-router]: http://wq.io/docs/app.py
--
cgit v1.2.3
From 54d3c6a725358ee5bb3e07450fb5efbaf957e1b7 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 13 Dec 2013 21:59:47 +0000
Subject: Updated release notes
---
docs/topics/release-notes.md | 1 +
1 file changed, 1 insertion(+)
(limited to 'docs')
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index 54865053..f171b1f5 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -43,6 +43,7 @@ You can determine your currently installed version using `pip freeze`:
### Master
* JSON renderer now deals with objects that implement a dict-like interface.
+* Fix compatiblity with newer versions of `django-oauth-plus`.
* Bugfix: Refine behavior that calls model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
* Bugfix: Allow defaults on BooleanFields to be properly honored when values are not supplied.
--
cgit v1.2.3
From f78b3187df11925caf07f9d86eb868de906c60c8 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 13 Dec 2013 22:01:19 +0000
Subject: Added @philipforget for work on #1232. Thanks :)
---
docs/topics/credits.md | 2 ++
1 file changed, 2 insertions(+)
(limited to 'docs')
diff --git a/docs/topics/credits.md b/docs/topics/credits.md
index 1a838421..d4c00bc4 100644
--- a/docs/topics/credits.md
+++ b/docs/topics/credits.md
@@ -181,6 +181,7 @@ The following people have helped make REST framework great.
* Alex Good - [alexjg]
* Ian Foote - [ian-foote]
* Chuck Harmston - [chuckharmston]
+* Philip Forget - [philipforget]
Many thanks to everyone who's contributed to the project.
@@ -398,3 +399,4 @@ You can also contact [@_tomchristie][twitter] directly on twitter.
[alexjg]: https://github.com/alexjg
[ian-foote]: https://github.com/ian-foote
[chuckharmston]: https://github.com/chuckharmston
+[philipforget]: https://github.com/philipforget
--
cgit v1.2.3
From 6b6b255684e8cfc25bf91168b46e9ab6512b800a Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Sat, 14 Dec 2013 20:42:58 +0000
Subject: Add note on pagination bugfix. Closes #1293.
---
docs/topics/release-notes.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
(limited to 'docs')
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index f171b1f5..d1ace116 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -89,6 +89,19 @@ You can determine your currently installed version using `pip freeze`:
* Bugfix: `client.force_authenticate(None)` should also clear session info if it exists.
* Bugfix: Client sending empty string instead of file now clears `FileField`.
* Bugfix: Empty values on ChoiceFields with `required=False` now consistently return `None`.
+* Bugfix: Clients setting `page=0` now simply returns the default page size, instead of disabling pagination. [*]
+
+---
+
+[*] Note that the change in `page=0` behaviour fixes what is considered to be a bug in how clients can effect the pagination size. However if you were relying on this behavior you will need to add the following mixin to your list views in order to preserve the existing behavior.
+
+ class DisablePaginationMixin(object):
+ def get_paginate_by(self, queryset=None):
+ if self.request.QUERY_PARAMS['self.paginate_by_param'] == '0':
+ return None
+ return super(DisablePaginationMixin, self).get_paginate_by(queryset)
+
+---
### 2.3.7
--
cgit v1.2.3
From 31dd160256a86c261099602dadb1163811a41e23 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 16 Dec 2013 11:59:14 +0000
Subject: Typo
---
docs/topics/contributing.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/topics/contributing.md b/docs/topics/contributing.md
index 906950bb..30d292f8 100644
--- a/docs/topics/contributing.md
+++ b/docs/topics/contributing.md
@@ -10,7 +10,7 @@ There are many ways you can contribute to Django REST framework. We'd like it t
The most important thing you can do to help push the REST framework project forward is to be actively involved wherever possible. Code contributions are often overvalued as being the primary way to get involved in a project, we don't believe that needs to be the case.
-If you use REST framework, we'd love you to be vocal about your experiences with it - you might consider writing a blog post about using REST framework, or publishing a tutorial about building a project with a particularJjavascript framework. Experiences from beginners can be particularly helpful because you'll be in the best position to assess which bits of REST framework are more difficult to understand and work with.
+If you use REST framework, we'd love you to be vocal about your experiences with it - you might consider writing a blog post about using REST framework, or publishing a tutorial about building a project with a particular Javascript framework. Experiences from beginners can be particularly helpful because you'll be in the best position to assess which bits of REST framework are more difficult to understand and work with.
Other really great ways you can help move the community forward include helping answer questions on the [discussion group][google-group], or setting up an [email alert on StackOverflow][so-filter] so that you get notified of any new questions with the `django-rest-framework` tag.
--
cgit v1.2.3
From 802648045476f91f1c4b6a9f507cc08625194c2c Mon Sep 17 00:00:00 2001
From: Xavier Ordoquy
Date: Tue, 17 Dec 2013 10:30:23 +0100
Subject: Use the BytesIO for buffering bytes and import the one from the
compat module.
---
docs/tutorial/1-serialization.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'docs')
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md
index e1c0009c..4d4e7258 100644
--- a/docs/tutorial/1-serialization.md
+++ b/docs/tutorial/1-serialization.md
@@ -183,9 +183,9 @@ At this point we've translated the model instance into Python native datatypes.
Deserialization is similar. First we parse a stream into Python native datatypes...
- import StringIO
+ from rest_framework.compat import BytesIO
- stream = StringIO.StringIO(content)
+ stream = BytesIO(content)
data = JSONParser().parse(stream)
...then we restore those native datatypes into to a fully populated object instance.
--
cgit v1.2.3
From 02ae1682b5585581e88bbd996f7cb7fd22b146f7 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Tue, 17 Dec 2013 09:45:28 +0000
Subject: Add note on compat import in tutorial
---
docs/tutorial/1-serialization.md | 2 ++
1 file changed, 2 insertions(+)
(limited to 'docs')
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md
index 4d4e7258..e015a545 100644
--- a/docs/tutorial/1-serialization.md
+++ b/docs/tutorial/1-serialization.md
@@ -183,6 +183,8 @@ At this point we've translated the model instance into Python native datatypes.
Deserialization is similar. First we parse a stream into Python native datatypes...
+ # This import will use either `StringIO.StringIO` or `io.BytesIO`
+ # as appropriate, depending on if we're running Python 2 or Python 3.
from rest_framework.compat import BytesIO
stream = BytesIO(content)
--
cgit v1.2.3
From 22343ee11764aac3686ad500da5c9aae30540e8e Mon Sep 17 00:00:00 2001
From: Vitaly Babiy
Date: Sat, 21 Dec 2013 07:05:21 -0500
Subject: Added links to djangorestframework-camel-case in the third party
sections of the docs for both parsers and renderers.
---
docs/api-guide/parsers.md | 6 ++++++
docs/api-guide/renderers.md | 7 +++++++
2 files changed, 13 insertions(+)
(limited to 'docs')
diff --git a/docs/api-guide/parsers.md b/docs/api-guide/parsers.md
index 1030fcb6..db0b666f 100644
--- a/docs/api-guide/parsers.md
+++ b/docs/api-guide/parsers.md
@@ -186,9 +186,15 @@ The following third party packages are also available.
[MessagePack][messagepack] is a fast, efficient binary serialization format. [Juan Riaza][juanriaza] maintains the [djangorestframework-msgpack][djangorestframework-msgpack] package which provides MessagePack renderer and parser support for REST framework.
+## CamelCase JSON
+
+[djangorestframework-camel-case] provides a camelCase JSON parser for django REST framework, its maintained by [vbabiy]
+
[jquery-ajax]: http://api.jquery.com/jQuery.ajax/
[cite]: https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion
[upload-handlers]: https://docs.djangoproject.com/en/dev/topics/http/file-uploads/#upload-handlers
[messagepack]: https://github.com/juanriaza/django-rest-framework-msgpack
[juanriaza]: https://github.com/juanriaza
+[vbabiy]: https://github.com/vbabiy
[djangorestframework-msgpack]: https://github.com/juanriaza/django-rest-framework-msgpack
+[djangorestframework-camel-case]: https://github.com/vbabiy/djangorestframework-camel-case
\ No newline at end of file
diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md
index cf200569..673b5902 100644
--- a/docs/api-guide/renderers.md
+++ b/docs/api-guide/renderers.md
@@ -419,6 +419,11 @@ Comma-separated values are a plain-text tabular data format, that can be easily
[UltraJSON][ultrajson] is an optimized C JSON encoder which can give significantly faster JSON rendering. [Jacob Haslehurst][hzy] maintains the [drf-ujson-renderer][drf-ujson-renderer] package which implements JSON rendering using the UJSON package.
+## CamelCase JSON
+
+[djangorestframework-camel-case] provides a camelCase JSON render for django REST framework, its maintained by [vbabiy]
+
+
[cite]: https://docs.djangoproject.com/en/dev/ref/template-response/#the-rendering-process
[conneg]: content-negotiation.md
[browser-accept-headers]: http://www.gethifi.com/blog/browser-rest-http-accept-headers
@@ -435,8 +440,10 @@ Comma-separated values are a plain-text tabular data format, that can be easily
[messagepack]: http://msgpack.org/
[juanriaza]: https://github.com/juanriaza
[mjumbewu]: https://github.com/mjumbewu
+[vbabiy]: https://github.com/vbabiy
[djangorestframework-msgpack]: https://github.com/juanriaza/django-rest-framework-msgpack
[djangorestframework-csv]: https://github.com/mjumbewu/django-rest-framework-csv
[ultrajson]: https://github.com/esnme/ultrajson
[hzy]: https://github.com/hzy
[drf-ujson-renderer]: https://github.com/gizmag/drf-ujson-renderer
+[djangorestframework-camel-case]: https://github.com/vbabiy/djangorestframework-camel-case
\ No newline at end of file
--
cgit v1.2.3
From 1f3ded4559ad18d03ee49b3befd19ddaea7e70b2 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Sat, 21 Dec 2013 17:18:25 +0000
Subject: Docs tweaks
---
docs/api-guide/parsers.md | 2 +-
docs/api-guide/renderers.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
(limited to 'docs')
diff --git a/docs/api-guide/parsers.md b/docs/api-guide/parsers.md
index db0b666f..72a4af64 100644
--- a/docs/api-guide/parsers.md
+++ b/docs/api-guide/parsers.md
@@ -188,7 +188,7 @@ The following third party packages are also available.
## CamelCase JSON
-[djangorestframework-camel-case] provides a camelCase JSON parser for django REST framework, its maintained by [vbabiy]
+[djangorestframework-camel-case] provides camel case JSON renderers and parsers for REST framework. This allows serializers to use Python-style underscored field names, but be exposed in the API as Javascript-style camel case field names. It is maintained by [Vitaly Babiy][vbabiy].
[jquery-ajax]: http://api.jquery.com/jQuery.ajax/
[cite]: https://groups.google.com/d/topic/django-developers/dxI4qVzrBY4/discussion
diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md
index 673b5902..7798827b 100644
--- a/docs/api-guide/renderers.md
+++ b/docs/api-guide/renderers.md
@@ -421,7 +421,7 @@ Comma-separated values are a plain-text tabular data format, that can be easily
## CamelCase JSON
-[djangorestframework-camel-case] provides a camelCase JSON render for django REST framework, its maintained by [vbabiy]
+[djangorestframework-camel-case] provides camel case JSON renderers and parsers for REST framework. This allows serializers to use Python-style underscored field names, but be exposed in the API as Javascript-style camel case field names. It is maintained by [Vitaly Babiy][vbabiy].
[cite]: https://docs.djangoproject.com/en/dev/ref/template-response/#the-rendering-process
--
cgit v1.2.3
From bc0e994784f46330b4e849c3326fbd5c500298b3 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Sat, 21 Dec 2013 21:10:05 +0000
Subject: Added example of using APIException class. Closes #1300
---
docs/api-guide/exceptions.md | 8 ++++++++
1 file changed, 8 insertions(+)
(limited to 'docs')
diff --git a/docs/api-guide/exceptions.md b/docs/api-guide/exceptions.md
index c46d415e..221df679 100644
--- a/docs/api-guide/exceptions.md
+++ b/docs/api-guide/exceptions.md
@@ -88,6 +88,14 @@ The **base class** for all exceptions raised inside REST framework.
To provide a custom exception, subclass `APIException` and set the `.status_code` and `.detail` properties on the class.
+For example, if your API relies on a third party service that may sometimes be unreachable, you might want to implement an exception for the "503 Service Unavailable" HTTP response code. You could do this like so:
+
+ from rest_framework.exceptions import APIException
+
+ class ServiceUnavailable(APIException):
+ status_code = 503
+ detail = 'Service temporarily unavailable, try again later.'
+
## ParseError
**Signature:** `ParseError(detail=None)`
--
cgit v1.2.3
From d6806340e54408858da4b2dc991be99edd65df76 Mon Sep 17 00:00:00 2001
From: amatellanes
Date: Mon, 23 Dec 2013 08:50:46 +0100
Subject: Simplified some examples in tutorial
---
docs/tutorial/1-serialization.md | 6 ++----
docs/tutorial/2-requests-and-responses.md | 6 ++----
docs/tutorial/4-authentication-and-permissions.md | 7 ++-----
3 files changed, 6 insertions(+), 13 deletions(-)
(limited to 'docs')
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md
index e015a545..2298df59 100644
--- a/docs/tutorial/1-serialization.md
+++ b/docs/tutorial/1-serialization.md
@@ -263,8 +263,7 @@ The root of our API is going to be a view that supports listing all the existing
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data, status=201)
- else:
- return JSONResponse(serializer.errors, status=400)
+ return JSONResponse(serializer.errors, status=400)
Note that because we want to be able to POST to this view from clients that won't have a CSRF token we need to mark the view as `csrf_exempt`. This isn't something that you'd normally want to do, and REST framework views actually use more sensible behavior than this, but it'll do for our purposes right now.
@@ -290,8 +289,7 @@ We'll also need a view which corresponds to an individual snippet, and can be us
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data)
- else:
- return JSONResponse(serializer.errors, status=400)
+ return JSONResponse(serializer.errors, status=400)
elif request.method == 'DELETE':
snippet.delete()
diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md
index 7fa4f3e4..603edd08 100644
--- a/docs/tutorial/2-requests-and-responses.md
+++ b/docs/tutorial/2-requests-and-responses.md
@@ -59,8 +59,7 @@ We don't need our `JSONResponse` class in `views.py` anymore, so go ahead and de
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
- else:
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Our instance view is an improvement over the previous example. It's a little more concise, and the code now feels very similar to if we were working with the Forms API. We're also using named status codes, which makes the response meanings more obvious.
@@ -85,8 +84,7 @@ Here is the view for an individual snippet, in the `views.py` module.
if serializer.is_valid():
serializer.save()
return Response(serializer.data)
- else:
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
elif request.method == 'DELETE':
snippet.delete()
diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md
index b472322a..986f13ff 100644
--- a/docs/tutorial/4-authentication-and-permissions.md
+++ b/docs/tutorial/4-authentication-and-permissions.md
@@ -163,15 +163,12 @@ In the snippets app, create a new file, `permissions.py`
"""
Custom permission to only allow owners of an object to edit it.
"""
-
+
def has_object_permission(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always allow GET, HEAD or OPTIONS requests.
- if request.method in permissions.SAFE_METHODS:
- return True
-
# Write permissions are only allowed to the owner of the snippet
- return obj.owner == request.user
+ return request.method in permissions.SAFE_METHODS or obj.owner == request.user
Now we can add that custom permission to our snippet instance endpoint, by editing the `permission_classes` property on the `SnippetDetail` class:
--
cgit v1.2.3
From 74f1cf635536ea99937954a11fa11531a832ebc2 Mon Sep 17 00:00:00 2001
From: amatellanes
Date: Mon, 23 Dec 2013 08:56:34 +0100
Subject: Revert "Simplified some examples in tutorial"
This reverts commit d6806340e54408858da4b2dc991be99edd65df76.
---
docs/tutorial/1-serialization.md | 6 ++++--
docs/tutorial/2-requests-and-responses.md | 6 ++++--
docs/tutorial/4-authentication-and-permissions.md | 7 +++++--
3 files changed, 13 insertions(+), 6 deletions(-)
(limited to 'docs')
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md
index 2298df59..e015a545 100644
--- a/docs/tutorial/1-serialization.md
+++ b/docs/tutorial/1-serialization.md
@@ -263,7 +263,8 @@ The root of our API is going to be a view that supports listing all the existing
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data, status=201)
- return JSONResponse(serializer.errors, status=400)
+ else:
+ return JSONResponse(serializer.errors, status=400)
Note that because we want to be able to POST to this view from clients that won't have a CSRF token we need to mark the view as `csrf_exempt`. This isn't something that you'd normally want to do, and REST framework views actually use more sensible behavior than this, but it'll do for our purposes right now.
@@ -289,7 +290,8 @@ We'll also need a view which corresponds to an individual snippet, and can be us
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data)
- return JSONResponse(serializer.errors, status=400)
+ else:
+ return JSONResponse(serializer.errors, status=400)
elif request.method == 'DELETE':
snippet.delete()
diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md
index 603edd08..7fa4f3e4 100644
--- a/docs/tutorial/2-requests-and-responses.md
+++ b/docs/tutorial/2-requests-and-responses.md
@@ -59,7 +59,8 @@ We don't need our `JSONResponse` class in `views.py` anymore, so go ahead and de
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ else:
+ return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Our instance view is an improvement over the previous example. It's a little more concise, and the code now feels very similar to if we were working with the Forms API. We're also using named status codes, which makes the response meanings more obvious.
@@ -84,7 +85,8 @@ Here is the view for an individual snippet, in the `views.py` module.
if serializer.is_valid():
serializer.save()
return Response(serializer.data)
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ else:
+ return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
elif request.method == 'DELETE':
snippet.delete()
diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md
index 986f13ff..b472322a 100644
--- a/docs/tutorial/4-authentication-and-permissions.md
+++ b/docs/tutorial/4-authentication-and-permissions.md
@@ -163,12 +163,15 @@ In the snippets app, create a new file, `permissions.py`
"""
Custom permission to only allow owners of an object to edit it.
"""
-
+
def has_object_permission(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always allow GET, HEAD or OPTIONS requests.
+ if request.method in permissions.SAFE_METHODS:
+ return True
+
# Write permissions are only allowed to the owner of the snippet
- return request.method in permissions.SAFE_METHODS or obj.owner == request.user
+ return obj.owner == request.user
Now we can add that custom permission to our snippet instance endpoint, by editing the `permission_classes` property on the `SnippetDetail` class:
--
cgit v1.2.3
From 2846ddb5d2ba84b3905d4dc0593afe3a0d4b2749 Mon Sep 17 00:00:00 2001
From: amatellanes
Date: Mon, 23 Dec 2013 09:06:03 +0100
Subject: Simplified some examples in tutorial
---
docs/tutorial/1-serialization.md | 6 ++----
docs/tutorial/2-requests-and-responses.md | 6 ++----
docs/tutorial/4-authentication-and-permissions.md | 7 ++-----
3 files changed, 6 insertions(+), 13 deletions(-)
(limited to 'docs')
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md
index e015a545..2298df59 100644
--- a/docs/tutorial/1-serialization.md
+++ b/docs/tutorial/1-serialization.md
@@ -263,8 +263,7 @@ The root of our API is going to be a view that supports listing all the existing
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data, status=201)
- else:
- return JSONResponse(serializer.errors, status=400)
+ return JSONResponse(serializer.errors, status=400)
Note that because we want to be able to POST to this view from clients that won't have a CSRF token we need to mark the view as `csrf_exempt`. This isn't something that you'd normally want to do, and REST framework views actually use more sensible behavior than this, but it'll do for our purposes right now.
@@ -290,8 +289,7 @@ We'll also need a view which corresponds to an individual snippet, and can be us
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data)
- else:
- return JSONResponse(serializer.errors, status=400)
+ return JSONResponse(serializer.errors, status=400)
elif request.method == 'DELETE':
snippet.delete()
diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md
index 7fa4f3e4..603edd08 100644
--- a/docs/tutorial/2-requests-and-responses.md
+++ b/docs/tutorial/2-requests-and-responses.md
@@ -59,8 +59,7 @@ We don't need our `JSONResponse` class in `views.py` anymore, so go ahead and de
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
- else:
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Our instance view is an improvement over the previous example. It's a little more concise, and the code now feels very similar to if we were working with the Forms API. We're also using named status codes, which makes the response meanings more obvious.
@@ -85,8 +84,7 @@ Here is the view for an individual snippet, in the `views.py` module.
if serializer.is_valid():
serializer.save()
return Response(serializer.data)
- else:
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+ return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
elif request.method == 'DELETE':
snippet.delete()
diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md
index b472322a..986f13ff 100644
--- a/docs/tutorial/4-authentication-and-permissions.md
+++ b/docs/tutorial/4-authentication-and-permissions.md
@@ -163,15 +163,12 @@ In the snippets app, create a new file, `permissions.py`
"""
Custom permission to only allow owners of an object to edit it.
"""
-
+
def has_object_permission(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always allow GET, HEAD or OPTIONS requests.
- if request.method in permissions.SAFE_METHODS:
- return True
-
# Write permissions are only allowed to the owner of the snippet
- return obj.owner == request.user
+ return request.method in permissions.SAFE_METHODS or obj.owner == request.user
Now we can add that custom permission to our snippet instance endpoint, by editing the `permission_classes` property on the `SnippetDetail` class:
--
cgit v1.2.3
From d8a95b4b6d4480089d38808b45a7b47f30e81cdd Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 23 Dec 2013 09:12:34 +0000
Subject: Back out permissions example change in favor of easier to follow
example
---
docs/tutorial/4-authentication-and-permissions.md | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'docs')
diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md
index 986f13ff..bdc6b579 100644
--- a/docs/tutorial/4-authentication-and-permissions.md
+++ b/docs/tutorial/4-authentication-and-permissions.md
@@ -163,12 +163,15 @@ In the snippets app, create a new file, `permissions.py`
"""
Custom permission to only allow owners of an object to edit it.
"""
-
+
def has_object_permission(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always allow GET, HEAD or OPTIONS requests.
- # Write permissions are only allowed to the owner of the snippet
- return request.method in permissions.SAFE_METHODS or obj.owner == request.user
+ if request.method in permissions.SAFE_METHODS:
+ return True
+
+ # Write permissions are only allowed to the owner of the snippet.
+ return obj.owner == request.user
Now we can add that custom permission to our snippet instance endpoint, by editing the `permission_classes` property on the `SnippetDetail` class:
--
cgit v1.2.3
From bed2f08c24a13831590ae5fc8cefbb1bca300a96 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 23 Dec 2013 11:57:25 +0000
Subject: Updated release notes
---
docs/topics/release-notes.md | 1 +
1 file changed, 1 insertion(+)
(limited to 'docs')
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index d1ace116..b09bd0be 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -46,6 +46,7 @@ You can determine your currently installed version using `pip freeze`:
* Fix compatiblity with newer versions of `django-oauth-plus`.
* Bugfix: Refine behavior that calls model manager `all()` across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
* Bugfix: Allow defaults on BooleanFields to be properly honored when values are not supplied.
+* Bugfix: Prevent double-escaping of non-latin1 URL query params when appending `format=json` params.
### 2.3.10
--
cgit v1.2.3
From d24ea39a4e4131486d45492339dcbbfefb6a933b Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 23 Dec 2013 14:29:22 +0000
Subject: Added note on view_name in hyperlinked relationships. Closes #1221
---
docs/api-guide/relations.md | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'docs')
diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md
index 1b089c54..4bee75af 100644
--- a/docs/api-guide/relations.md
+++ b/docs/api-guide/relations.md
@@ -134,7 +134,7 @@ By default this field is read-write, although you can change this behavior using
**Arguments**:
-* `view_name` - The view name that should be used as the target of the relationship. **required**.
+* `view_name` - The view name that should be used as the target of the relationship. If you're using [the standard router classes][routers] this wil be a string with the format `
-detail`. **required**.
* `many` - If applied to a to-many relationship, you should set this argument to `True`.
* `required` - If set to `False`, the field will accept values of `None` or the empty-string for nullable relationships.
* `queryset` - By default `ModelSerializer` classes will use the default queryset for the relationship. `Serializer` classes must either set a queryset explicitly, or set `read_only=True`.
@@ -202,7 +202,7 @@ This field is always read-only.
**Arguments**:
-* `view_name` - The view name that should be used as the target of the relationship. **required**.
+* `view_name` - The view name that should be used as the target of the relationship. If you're using [the standard router classes][routers] this wil be a string with the format `-detail`. **required**.
* `lookup_field` - The field on the target that should be used for the lookup. Should correspond to a URL keyword argument on the referenced view. Default is `'pk'`.
* `format` - If using format suffixes, hyperlinked fields will use the same format suffix for the target unless overridden by using the `format` argument.
@@ -454,6 +454,7 @@ The [drf-nested-routers package][drf-nested-routers] provides routers and relati
[cite]: http://lwn.net/Articles/193245/
[reverse-relationships]: https://docs.djangoproject.com/en/dev/topics/db/queries/#following-relationships-backward
+[routers]: http://django-rest-framework.org/api-guide/routers#defaultrouter
[generic-relations]: https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1
[2.2-announcement]: ../topics/2.2-announcement.md
[drf-nested-routers]: https://github.com/alanjds/drf-nested-routers
--
cgit v1.2.3
From 75e872473197f9b810c9daf348cb452faadac476 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Mon, 23 Dec 2013 14:38:51 +0000
Subject: Fuller notes on the 'base_name' argument. Closes #1160.
---
docs/api-guide/routers.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
(limited to 'docs')
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 895589db..7efc140a 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -37,6 +37,18 @@ The example above would generate the following URL patterns:
* URL pattern: `^accounts/$` Name: `'account-list'`
* URL pattern: `^accounts/{pk}/$` Name: `'account-detail'`
+---
+
+**Note**: The `base_name` argument is used to specify the initial part of the view name pattern. In the example above, that's the `user` or `account` part.
+
+Typically you won't *need* to specify the `base-name` argument, but if you have a viewset where you've defined a custom `get_queryset` method, then the viewset may not have any `.model` or `.queryset` attribute set. If you try to register that viewset you'll see an error like this:
+
+ 'base_name' argument not specified, and could not automatically determine the name from the viewset, as it does not have a '.model' or '.queryset' attribute.
+
+This means you'll need to explicitly set the `base_name` argument when registering the viewset, as it could not be automatically determined from the model name.
+
+---
+
### Extra link and actions
Any methods on the viewset decorated with `@link` or `@action` will also be routed.
--
cgit v1.2.3
From 1f3f2741f519967aa236cd861a79c2c459063197 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Thu, 2 Jan 2014 09:28:34 +0000
Subject: Happy new year
---
docs/index.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/index.md b/docs/index.md
index 04804fa7..7688d428 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -219,7 +219,7 @@ Send a description of the issue via email to [rest-framework-security@googlegrou
## License
-Copyright (c) 2011-2013, Tom Christie
+Copyright (c) 2011-2014, Tom Christie
All rights reserved.
Redistribution and use in source and binary forms, with or without
--
cgit v1.2.3
From 0672d6de6e47ba0269a58ad0da3cc7ff4c82908e Mon Sep 17 00:00:00 2001
From: Kevin Brown
Date: Thu, 2 Jan 2014 16:46:57 -0500
Subject: Fix bugfix note
This fixes a bugfix note that was added because of #1293, which
pointed out that a change in a bugfix [1] broke backwards
compatibility. The bugfix did not work as expected because a
variable was quoted when it should not have been. This removes
the quotes around the variable, which brings back the expected
functionality.
---
docs/topics/release-notes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index b09bd0be..ca966d20 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -98,7 +98,7 @@ You can determine your currently installed version using `pip freeze`:
class DisablePaginationMixin(object):
def get_paginate_by(self, queryset=None):
- if self.request.QUERY_PARAMS['self.paginate_by_param'] == '0':
+ if self.request.QUERY_PARAMS[self.paginate_by_param] == '0':
return None
return super(DisablePaginationMixin, self).get_paginate_by(queryset)
--
cgit v1.2.3
From 3050f0e82a60a12dc35ef7947c2f47de12387919 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 3 Jan 2014 13:06:41 +0000
Subject: Frontpage tweaks
---
docs/img/logo.png | Bin 0 -> 45955 bytes
docs/index.md | 26 +++++++++++++++++++-------
2 files changed, 19 insertions(+), 7 deletions(-)
create mode 100644 docs/img/logo.png
(limited to 'docs')
diff --git a/docs/img/logo.png b/docs/img/logo.png
new file mode 100644
index 00000000..0f0cf800
Binary files /dev/null and b/docs/img/logo.png differ
diff --git a/docs/index.md b/docs/index.md
index 7688d428..15eaf8d6 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,4 +1,4 @@
-
+
@@ -7,9 +7,15 @@
-# Django REST framework
+---
+
+
+
+
-**Awesome web-browsable Web APIs.**
+
Django REST framework is a powerful and flexible toolkit that makes it easy to build Web APIs.
@@ -20,13 +26,16 @@ Some reasons you might want to use REST framework:
* [Serialization][serializers] that supports both [ORM][modelserializer-section] and [non-ORM][serializer-section] data sources.
* Customizable all the way down - just use [regular function-based views][functionview-section] if you don't need the [more][generic-views] [powerful][viewsets] [features][routers].
* [Extensive documentation][index], and [great community support][group].
+* Used and trusted by large companies such as [Mozilla][mozilla] and [Eventbrite][eventbrite].
-There is a live example API for testing purposes, [available here][sandbox].
-
-**Below**: *Screenshot from the browsable API*
+---
![Screenshot][image]
+**Above**: *Screenshot from the browsable API*
+
+----
+
## Requirements
REST framework requires the following:
@@ -140,6 +149,8 @@ The tutorial will walk you through the building blocks that make up REST framewo
* [5 - Relationships & hyperlinked APIs][tut-5]
* [6 - Viewsets & routers][tut-6]
+There is a live example API of the finished tutorial API for testing purposes, [available here][sandbox].
+
## API Guide
The API guide is your complete reference manual to all the functionality provided by REST framework.
@@ -244,7 +255,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[travis]: http://travis-ci.org/tomchristie/django-rest-framework?branch=master
[travis-build-image]: https://secure.travis-ci.org/tomchristie/django-rest-framework.png?branch=master
-[urlobject]: https://github.com/zacharyvoase/urlobject
+[mozilla]: http://www.mozilla.org/en-US/about/
+[eventbrite]: https://www.eventbrite.co.uk/about/
[markdown]: http://pypi.python.org/pypi/Markdown/
[yaml]: http://pypi.python.org/pypi/PyYAML
[defusedxml]: https://pypi.python.org/pypi/defusedxml
--
cgit v1.2.3
From 442916b9649baaf305ff094fe05f026ad04c7818 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Fri, 3 Jan 2014 13:24:52 +0000
Subject: Link to BrightAPI, and remove ad except from frontpage
---
docs/template.html | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
(limited to 'docs')
diff --git a/docs/template.html b/docs/template.html
index c065237a..a397d067 100644
--- a/docs/template.html
+++ b/docs/template.html
@@ -170,31 +170,12 @@
+{{ ad_block }}
+
+
+
-
--
cgit v1.2.3
From a1d7aa8f712b659f9d8302a2d2a098d2538e6c89 Mon Sep 17 00:00:00 2001
From: Paul Melnikow
Date: Thu, 2 Jan 2014 17:44:47 -0500
Subject: Allow viewset to specify lookup value regex for routing
This patch allows a viewset to define a pattern for its lookup field, which the router will honor. Without this patch, any characters are allowed in the lookup field, and overriding this behavior requires subclassing router and copying and pasting the implementation of get_lookup_regex.
It's possible it would be better to remove this functionality from the routers and simply expose a parameter to get_lookup_regex which allows overriding the lookup_regex. That way the viewset config logic could be in the a subclass, which could invoke the super method directly.
I'm using this now for PostgreSQL UUID fields using https://github.com/dcramer/django-uuidfield . Without this patch, that field passes the lookup string to the database driver, which raises a DataError to complain about the invalid UUID. It's possible the field ought to signal this error in a different way, which could obviate the need to specify a pattern.
---
docs/api-guide/routers.md | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'docs')
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 846ac9f9..f3beabdd 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -83,6 +83,12 @@ This behavior can be modified by setting the `trailing_slash` argument to `False
Trailing slashes are conventional in Django, but are not used by default in some other frameworks such as Rails. Which style you choose to use is largely a matter of preference, although some javascript frameworks may expect a particular routing style.
+With `trailing_slash` set to True, the router will match lookup values containing any characters except slashes and dots. When set to False, dots are allowed. To restrict the lookup pattern, set the `lookup_field_regex` attribute on the viewset. For example, you can limit the lookup to valid UUIDs:
+
+ class MyModelViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
+ lookup_field = 'my_model_id'
+ lookup_value_regex = '[0-9a-f]{32}'
+
## DefaultRouter
This router is similar to `SimpleRouter` as above, but additionally includes a default API root view, that returns a response containing hyperlinks to all the list views. It also generates routes for optional `.json` style format suffixes.
--
cgit v1.2.3
From 3cd15fb1713dfc49e1bf1fd48045ca3ae5654e18 Mon Sep 17 00:00:00 2001
From: Paul Melnikow
Date: Sat, 4 Jan 2014 16:57:50 -0500
Subject: Router: Do not automatically adjust lookup_regex when trailing_slash
is True
BREAKING CHANGE
When trailing_slash is set to True, the router no longer will adjust the lookup regex to allow it to include periods. To simulate the old behavior, the programmer should specify `lookup_regex = '[^/]+'` on the viewset.
https://github.com/tomchristie/django-rest-framework/pull/1328#issuecomment-31517099
---
docs/api-guide/routers.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index f3beabdd..6b4ae6db 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -83,7 +83,7 @@ This behavior can be modified by setting the `trailing_slash` argument to `False
Trailing slashes are conventional in Django, but are not used by default in some other frameworks such as Rails. Which style you choose to use is largely a matter of preference, although some javascript frameworks may expect a particular routing style.
-With `trailing_slash` set to True, the router will match lookup values containing any characters except slashes and dots. When set to False, dots are allowed. To restrict the lookup pattern, set the `lookup_field_regex` attribute on the viewset. For example, you can limit the lookup to valid UUIDs:
+The router will match lookup values containing any characters except slashes and period characters. For a more restrictive (or lenient) lookup pattern, set the `lookup_field_regex` attribute on the viewset. For example, you can limit the lookup to valid UUIDs:
class MyModelViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
lookup_field = 'my_model_id'
--
cgit v1.2.3
From 899381575a6038f550a064261ed5c6ba0655211b Mon Sep 17 00:00:00 2001
From: Paul Melnikow
Date: Sat, 4 Jan 2014 17:03:01 -0500
Subject: Fix a typo
---
docs/api-guide/routers.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'docs')
diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md
index 6b4ae6db..249e99a4 100644
--- a/docs/api-guide/routers.md
+++ b/docs/api-guide/routers.md
@@ -83,7 +83,7 @@ This behavior can be modified by setting the `trailing_slash` argument to `False
Trailing slashes are conventional in Django, but are not used by default in some other frameworks such as Rails. Which style you choose to use is largely a matter of preference, although some javascript frameworks may expect a particular routing style.
-The router will match lookup values containing any characters except slashes and period characters. For a more restrictive (or lenient) lookup pattern, set the `lookup_field_regex` attribute on the viewset. For example, you can limit the lookup to valid UUIDs:
+The router will match lookup values containing any characters except slashes and period characters. For a more restrictive (or lenient) lookup pattern, set the `lookup_value_regex` attribute on the viewset. For example, you can limit the lookup to valid UUIDs:
class MyModelViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
lookup_field = 'my_model_id'
--
cgit v1.2.3
From 2b033d2456d39c35c9e874ec532f75e6fa7a09c8 Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Tue, 7 Jan 2014 14:57:00 +0000
Subject: New font in logo
---
docs/img/logo.png | Bin 45955 -> 41532 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
(limited to 'docs')
diff --git a/docs/img/logo.png b/docs/img/logo.png
index 0f0cf800..73de34f4 100644
Binary files a/docs/img/logo.png and b/docs/img/logo.png differ
--
cgit v1.2.3
From 78494401c5c45d16d632bb2fa9629678e47a98bc Mon Sep 17 00:00:00 2001
From: Tom Christie
Date: Wed, 8 Jan 2014 15:22:41 +0000
Subject: Use www.django-rest-framework.org for docs instead of
django-rest-framework.org due to issues with naked domains
---
docs/404.html | 104 ++++++++++++++++++++--------------------
docs/api-guide/relations.md | 2 +-
docs/index.md | 2 +-
docs/topics/2.2-announcement.md | 2 +-
4 files changed, 55 insertions(+), 55 deletions(-)
(limited to 'docs')
diff --git a/docs/404.html b/docs/404.html
index 4938da6e..864247e7 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -3,17 +3,17 @@