aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/settings.md
diff options
context:
space:
mode:
authorTom Christie2012-10-30 14:32:31 +0000
committerTom Christie2012-10-30 14:32:31 +0000
commit9b30dab4f772f67a626e176dc4fae0a3ef9c2c81 (patch)
treeca138abf4792f58ffa28684f784f201ee1eef6d7 /docs/api-guide/settings.md
parent7e5b1501b5cede61a9391fb1a751d2ebcdb37031 (diff)
parent4e7805cb24d73e7f706318b5e5a27e3f9ba39d14 (diff)
downloaddjango-rest-framework-9b30dab4f772f67a626e176dc4fae0a3ef9c2c81.tar.bz2
Merge branch 'restframework2' into rest-framework-2-merge2.0.0
Conflicts: .gitignore .travis.yml AUTHORS README.rst djangorestframework/mixins.py djangorestframework/renderers.py djangorestframework/resources.py djangorestframework/serializer.py djangorestframework/templates/djangorestframework/base.html djangorestframework/templates/djangorestframework/login.html djangorestframework/templatetags/add_query_param.py djangorestframework/tests/accept.py djangorestframework/tests/authentication.py djangorestframework/tests/content.py djangorestframework/tests/reverse.py djangorestframework/tests/serializer.py djangorestframework/views.py docs/examples.rst docs/examples/blogpost.rst docs/examples/modelviews.rst docs/examples/objectstore.rst docs/examples/permissions.rst docs/examples/pygments.rst docs/examples/views.rst docs/howto/alternativeframeworks.rst docs/howto/mixin.rst docs/howto/reverse.rst docs/howto/usingurllib2.rst docs/index.rst docs/topics/release-notes.md examples/sandbox/views.py rest_framework/__init__.py rest_framework/compat.py rest_framework/utils/breadcrumbs.py setup.py
Diffstat (limited to 'docs/api-guide/settings.md')
-rw-r--r--docs/api-guide/settings.md153
1 files changed, 153 insertions, 0 deletions
diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md
new file mode 100644
index 00000000..a3668e2a
--- /dev/null
+++ b/docs/api-guide/settings.md
@@ -0,0 +1,153 @@
+<a class="github" href="settings.py"></a>
+
+# Settings
+
+> Namespaces are one honking great idea - let's do more of those!
+>
+> &mdash; [The Zen of Python][cite]
+
+Configuration for REST framework is all namespaced inside a single Django setting, named `REST_FRAMEWORK`.
+
+For example your project's `settings.py` file might include something like this:
+
+ REST_FRAMEWORK = {
+ 'DEFAULT_RENDERER_CLASSES': (
+ 'rest_framework.renderers.YAMLRenderer',
+ )
+ 'DEFAULT_PARSER_CLASSES': (
+ 'rest_framework.parsers.YAMLParser',
+ )
+ }
+
+## Accessing settings
+
+If you need to access the values of REST framework's API settings in your project,
+you should use the `api_settings` object. For example.
+
+ from rest_framework.settings import api_settings
+
+ print api_settings.DEFAULT_AUTHENTICATION_CLASSES
+
+The `api_settings` object will check for any user-defined settings, and otherwise fallback to the default values. Any setting that uses string import paths to refer to a class will automatically import and return the referenced class, instead of the string literal.
+
+---
+
+# API Reference
+
+## DEFAULT_RENDERER_CLASSES
+
+A list or tuple of renderer classes, that determines the default set of renderers that may be used when returning a `Response` object.
+
+Default:
+
+ (
+ 'rest_framework.renderers.JSONRenderer',
+ 'rest_framework.renderers.BrowsableAPIRenderer',
+ 'rest_framework.renderers.TemplateHTMLRenderer'
+ )
+
+## DEFAULT_PARSER_CLASSES
+
+A list or tuple of parser classes, that determines the default set of parsers used when accessing the `request.DATA` property.
+
+Default:
+
+ (
+ 'rest_framework.parsers.JSONParser',
+ 'rest_framework.parsers.FormParser'
+ )
+
+## DEFAULT_AUTHENTICATION_CLASSES
+
+A list or tuple of authentication classes, that determines the default set of authenticators used when accessing the `request.user` or `request.auth` properties.
+
+Default:
+
+ (
+ 'rest_framework.authentication.SessionAuthentication',
+ 'rest_framework.authentication.UserBasicAuthentication'
+ )
+
+## DEFAULT_PERMISSION_CLASSES
+
+A list or tuple of permission classes, that determines the default set of permissions checked at the start of a view.
+
+Default:
+
+ (
+ 'rest_framework.permissions.AllowAny',
+ )
+
+## DEFAULT_THROTTLE_CLASSES
+
+A list or tuple of throttle classes, that determines the default set of throttles checked at the start of a view.
+
+Default: `()`
+
+## DEFAULT_MODEL_SERIALIZER_CLASS
+
+**TODO**
+
+Default: `rest_framework.serializers.ModelSerializer`
+
+## DEFAULT_PAGINATION_SERIALIZER_CLASS
+
+**TODO**
+
+Default: `rest_framework.pagination.PaginationSerializer`
+
+## FORMAT_SUFFIX_KWARG
+
+**TODO**
+
+Default: `'format'`
+
+## UNAUTHENTICATED_USER
+
+The class that should be used to initialize `request.user` for unauthenticated requests.
+
+Default: `django.contrib.auth.models.AnonymousUser`
+
+## UNAUTHENTICATED_TOKEN
+
+The class that should be used to initialize `request.auth` for unauthenticated requests.
+
+Default: `None`
+
+## FORM_METHOD_OVERRIDE
+
+The name of a form field that may be used to override the HTTP method of the form.
+
+If the value of this setting is `None` then form method overloading will be disabled.
+
+Default: `'_method'`
+
+## FORM_CONTENT_OVERRIDE
+
+The name of a form field that may be used to override the content of the form payload. Must be used together with `FORM_CONTENTTYPE_OVERRIDE`.
+
+If either setting is `None` then form content overloading will be disabled.
+
+Default: `'_content'`
+
+## FORM_CONTENTTYPE_OVERRIDE
+
+The name of a form field that may be used to override the content type of the form payload. Must be used together with `FORM_CONTENT_OVERRIDE`.
+
+If either setting is `None` then form content overloading will be disabled.
+
+Default: `'_content_type'`
+
+## URL_ACCEPT_OVERRIDE
+
+The name of a URL parameter that may be used to override the HTTP `Accept` header.
+
+If the value of this setting is `None` then URL accept overloading will be disabled.
+
+Default: `'accept'`
+
+## URL_FORMAT_OVERRIDE
+
+Default: `'format'`
+
+[cite]: http://www.python.org/dev/peps/pep-0020/