File: settings.rst

package info (click to toggle)
django-tastypie 0.9.10-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,020 kB
  • sloc: python: 6,530; makefile: 78; sh: 45
file content (101 lines) | stat: -rw-r--r-- 2,382 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.. _ref-settings:

=================
Tastypie Settings
=================

This is a comprehensive list of the settings Tastypie recognizes.


``API_LIMIT_PER_PAGE``
======================

**Optional**

This setting controls the default number of records Tastypie will show
in a list view.

This is only used when a user does not specify a ``limit`` GET parameter and
the ``Resource`` subclass has not overridden the number to be shown.

An example::

    API_LIMIT_PER_PAGE = 50

Defaults to 20.


``TASTYPIE_FULL_DEBUG``
=======================

**Optional**

This setting controls what the behavior is when an unhandled exception occurs.

If set to ``True`` and ``settings.DEBUG = True``, the standard Django
technical 500 is displayed.

If not set or set to ``False``, Tastypie will return a serialized response.
If ``settings.DEBUG`` is ``True``, you'll get the actual exception message plus
a traceback. If ``settings.DEBUG`` is ``False``, Tastypie will call
``mail_admins()`` and provide a canned error message (which you can override
with ``TASTYPIE_CANNED_ERROR``) in the response.

An example::

    TASTYPIE_FULL_DEBUG = True

Defaults to ``False``.


``TASTYPIE_CANNED_ERROR``
=========================

**Optional**

This setting allows you to override the canned error response when an
unhandled exception is raised and ``settings.DEBUG`` is ``False``.

An example::

    TASTYPIE_CANNED_ERROR = "Oops, we broke it!"

Defaults to ``"Sorry, this request could not be processed. Please try again later."``.


``TASTYPIE_ALLOW_MISSING_SLASH``
================================

**Optional**

This setting allows your URLs to be missing the final slash. Useful for
integrating with other systems.

You must also have ``settings.APPEND_SLASH = False`` so that Django does not
emit HTTP 302 redirects.

.. warning::

  This setting causes the ``Resource.get_multiple()`` method to fail. If you
  need this method, you will have to override the URLconf to meet your needs.

An example::

    TASTYPIE_ALLOW_MISSING_SLASH = True

Defaults to ``False``.


``TASTYPIE_DATETIME_FORMATTING``
================================

**Optional**

This setting allows you to globally choose what format your datetime/date/time
data will be formatted in. Valid options are ``iso-8601`` & ``rfc-2822``.

An example::

    TASTYPIE_DATETIME_FORMATTING = 'rfc-2822'

Defaults to ``iso-8601``.