From 987880e13138a93d9cc0e44b7ed30297909f7b03 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Tue, 27 Jan 2015 23:15:26 +0100 Subject: Update documentation --- api-guide/authentication/index.html | 2 +- api-guide/fields/index.html | 31 ++++++++++++++++++++++++++++--- api-guide/filtering/index.html | 6 +++--- api-guide/routers/index.html | 6 +++--- api-guide/viewsets/index.html | 2 +- 5 files changed, 36 insertions(+), 11 deletions(-) (limited to 'api-guide') diff --git a/api-guide/authentication/index.html b/api-guide/authentication/index.html index ac8f4629..7a523c63 100644 --- a/api-guide/authentication/index.html +++ b/api-guide/authentication/index.html @@ -648,7 +648,7 @@ python manage.py createsuperuser
request.auth will be None.Unauthenticated responses that are denied permission will result in an HTTP 403 Forbidden response.
If you're using an AJAX style API with SessionAuthentication, you'll need to make sure you include a valid CSRF token for any "unsafe" HTTP method calls, such as PUT, PATCH, POST or DELETE requests.  See the Django CSRF documentation for more details.
If you're using an AJAX style API with SessionAuthentication, you'll need to make sure you include a valid CSRF token for any "unsafe" HTTP method calls, such as PUT, PATCH, POST or DELETE requests.  See the Django CSRF documentation for more details.
This authentication uses OAuth 1.0a authentication scheme. OAuth 1.0a provides signature validation which provides a reasonable level of security over plain non-HTTPS connections. However, it may also be considered more complicated than OAuth2, as it requires clients to sign their requests.
This authentication class depends on the optional django-oauth-plus and oauth2 packages.  In order to make it work you must install these packages and add oauth_provider to your INSTALLED_APPS:
A RegexField that validates the input against a URL matching pattern. Expects fully qualified URLs of the form http://<host>/<path>.
Corresponds to django.db.models.fields.URLField.  Uses Django's django.core.validators.URLValidator for validation.
Signature: URLField(max_length=200, min_length=None, allow_blank=False)
A field that ensures the input is a valid UUID string. The to_internal_value method will return a uuid.UUID instance. On output the field will return a string in the canonical hyphenated format, for example:
"de305d54-75b4-431b-adb2-eb6b9e546013"
+Both the allow_blank and allow_null are valid options on ChoiceField, although it is highly recommended that you only use one and not both. allow_blank should be preferred for textual choices, and allow_null should be preferred for numeric or other non-textual choices.
A field that can accept a set of zero, one or many values, chosen from a limited set of choices. Takes a single mandatory argument. to_internal_representation returns a set containing the selected values.
A field that can accept a set of zero, one or many values, chosen from a limited set of choices. Takes a single mandatory argument. to_internal_value returns a set containing the selected values.
Signature: MultipleChoiceField(choices)
choices - A list of valid values, or a list of (key, display_name) tuples.We can now reuse our custom StringListField class throughout our application, without having to provide a child argument to it.
A field class that validates a dictionary of objects. The keys in DictField are always assumed to be string values.
Signature: DictField(child)
child - A field instance that should be used for validating the values in the dictionary. If this argument is not provided then values in the mapping will not be validated.For example, to create a field that validates a mapping of strings to strings, you would write something like this:
+document = DictField(child=CharField())
+You can also use the declarative style, as with ListField. For example:
class DocumentField(DictField):
+    child = CharField()
+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.
The following third party packages provide additional filter implementations.
-The django-rest-framework-chain package 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.
The django-rest-framework-filters package 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.
Alternatively you can use Django's include function, like so…
urlpatterns = [
-    url(r'^forgot-password/$, ForgotPasswordFormView.as_view(),
+    url(r'^forgot-password/$', ForgotPasswordFormView.as_view(),
     url(r'^', include(router.urls))
 ]
 Router URL patterns can also be namespaces.
urlpatterns = [
-    url(r'^forgot-password/$, ForgotPasswordFormView.as_view(),
+    url(r'^forgot-password/$', ForgotPasswordFormView.as_view(),
     url(r'^api/', include(router.urls, namespace='api'))
 ]
 Theses decorators will route GET requests by default, but may also accept other HTTP methods, by using the methods argument.  For example:
These decorators will route GET requests by default, but may also accept other HTTP methods, by using the methods argument.  For example:
    @detail_route(methods=['post', 'delete'])
     def unset_password(self, request, pk=None):
        ...
-- 
cgit v1.2.3