Fixed many more ReST indentation errors, somehow accidentally missed from [16955]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant 2011-10-14 00:12:01 +00:00
parent 5109ac3709
commit d1e5c55258
129 changed files with 5708 additions and 5740 deletions

View File

@ -144,9 +144,7 @@ production environment (that is, where :setting:`DEBUG` is set to ``False``):
If a function (either a view or any regular callback) in your code uses If a function (either a view or any regular callback) in your code uses
local variables susceptible to contain sensitive information, you may local variables susceptible to contain sensitive information, you may
prevent the values of those variables from being included in error reports prevent the values of those variables from being included in error reports
using the ``sensitive_variables`` decorator: using the ``sensitive_variables`` decorator::
.. code-block:: python
from django.views.decorators.debug import sensitive_variables from django.views.decorators.debug import sensitive_variables
@ -163,9 +161,7 @@ production environment (that is, where :setting:`DEBUG` is set to ``False``):
disclosed. disclosed.
To systematically hide all local variables of a function from error logs, To systematically hide all local variables of a function from error logs,
do not provide any argument to the ``sensitive_variables`` decorator: do not provide any argument to the ``sensitive_variables`` decorator::
.. code-block:: python
@sensitive_variables() @sensitive_variables()
def my_function(): def my_function():
@ -177,9 +173,7 @@ production environment (that is, where :setting:`DEBUG` is set to ``False``):
:attr:`POST parameters<HttpRequest.POST>` susceptible to contain sensitive :attr:`POST parameters<HttpRequest.POST>` susceptible to contain sensitive
information, you may prevent the values of those parameters from being information, you may prevent the values of those parameters from being
included in the error reports using the ``sensitive_post_parameters`` included in the error reports using the ``sensitive_post_parameters``
decorator: decorator::
.. code-block:: python
from django.views.decorators.debug import sensitive_post_parameters from django.views.decorators.debug import sensitive_post_parameters
@ -197,9 +191,7 @@ production environment (that is, where :setting:`DEBUG` is set to ``False``):
reports, whereas the value of the ``name`` parameter will be disclosed. reports, whereas the value of the ``name`` parameter will be disclosed.
To systematically hide all POST parameters of a request in error reports, To systematically hide all POST parameters of a request in error reports,
do not provide any argument to the ``sensitive_post_parameters`` decorator: do not provide any argument to the ``sensitive_post_parameters`` decorator::
.. code-block:: python
@sensitive_post_parameters() @sensitive_post_parameters()
def my_view(request): def my_view(request):
@ -231,17 +223,13 @@ decorators' annotations to replace the corresponding values with stars
(`**********`) when the error reports are produced. If you wish to override or (`**********`) when the error reports are produced. If you wish to override or
customize this default behavior for your entire site, you need to define your customize this default behavior for your entire site, you need to define your
own filter class and tell Django to use it via the own filter class and tell Django to use it via the
:setting:`DEFAULT_EXCEPTION_REPORTER_FILTER` setting: :setting:`DEFAULT_EXCEPTION_REPORTER_FILTER` setting::
.. code-block:: python
DEFAULT_EXCEPTION_REPORTER_FILTER = 'path.to.your.CustomExceptionReporterFilter' DEFAULT_EXCEPTION_REPORTER_FILTER = 'path.to.your.CustomExceptionReporterFilter'
You may also control in a more granular way which filter to use within any You may also control in a more granular way which filter to use within any
given view by setting the ``HttpRequest``'s ``exception_reporter_filter`` given view by setting the ``HttpRequest``'s ``exception_reporter_filter``
attribute: attribute::
.. code-block:: python
def my_view(request): def my_view(request):
if request.user.is_authenticated(): if request.user.is_authenticated():

View File

@ -189,18 +189,22 @@ A number of flags, appearing as checkboxes in Trac, can be set on a ticket:
This means the ticket has an associated This means the ticket has an associated
:doc:`patch<writing-code/submitting-patches>`. These will be reviewed :doc:`patch<writing-code/submitting-patches>`. These will be reviewed
to see if the patch is "good". to see if the patch is "good".
* Needs documentation: * Needs documentation:
This flag is used for tickets with patches that need associated This flag is used for tickets with patches that need associated
documentation. Complete documentation of features is a prerequisite documentation. Complete documentation of features is a prerequisite
before we can check them into the codebase. before we can check them into the codebase.
* Needs tests * Needs tests
This flags the patch as needing associated unit tests. Again, this This flags the patch as needing associated unit tests. Again, this
is a required part of a valid patch. is a required part of a valid patch.
* Patch needs improvement * Patch needs improvement
This flag means that although the ticket *has* a patch, it's not quite This flag means that although the ticket *has* a patch, it's not quite
ready for checkin. This could mean the patch no longer applies ready for checkin. This could mean the patch no longer applies
cleanly, there is a flaw in the implementation, or that the code cleanly, there is a flaw in the implementation, or that the code
doesn't meet our standards. doesn't meet our standards.
* Easy pickings * Easy pickings
Tickets that would require small, easy, patches. Tickets that would require small, easy, patches.

View File

@ -324,8 +324,8 @@ For each field, we describe the default widget used if you don't specify
Has two optional arguments for validation: Has two optional arguments for validation:
.. attribute:: CharField.max_length .. attribute:: max_length
.. attribute:: CharField.min_length .. attribute:: min_length
If provided, these arguments ensure that the string is at most or at least If provided, these arguments ensure that the string is at most or at least
the given length. the given length.
@ -346,7 +346,7 @@ replaced with the selected choice.
Takes one extra required argument: Takes one extra required argument:
.. attribute:: ChoiceField.choices .. attribute:: choices
An iterable (e.g., a list or tuple) of 2-tuples to use as choices for this An iterable (e.g., a list or tuple) of 2-tuples to use as choices for this
field. This argument accepts the same formats as the ``choices`` argument field. This argument accepts the same formats as the ``choices`` argument
@ -370,13 +370,13 @@ extra arguments, ``coerce`` and ``empty_value``.
Takes extra arguments: Takes extra arguments:
.. attribute:: TypedChoiceField.coerce .. attribute:: coerce
A function that takes one argument and returns a coerced value. Examples A function that takes one argument and returns a coerced value. Examples
include the built-in ``int``, ``float``, ``bool`` and other types. Defaults include the built-in ``int``, ``float``, ``bool`` and other types. Defaults
to an identity function. to an identity function.
.. attribute:: TypedChoiceField.empty_value .. attribute:: empty_value
The value to use to represent "empty." Defaults to the empty string; The value to use to represent "empty." Defaults to the empty string;
``None`` is another common choice here. Note that this value will not be ``None`` is another common choice here. Note that this value will not be
@ -397,7 +397,7 @@ Takes extra arguments:
Takes one optional argument: Takes one optional argument:
.. attribute:: DateField.input_formats .. attribute:: input_formats
A list of formats used to attempt to convert a string to a valid A list of formats used to attempt to convert a string to a valid
``datetime.date`` object. ``datetime.date`` object.
@ -424,7 +424,7 @@ If no ``input_formats`` argument is provided, the default input formats are::
Takes one optional argument: Takes one optional argument:
.. attribute:: DateTimeField.input_formats .. attribute:: input_formats
A list of formats used to attempt to convert a string to a valid A list of formats used to attempt to convert a string to a valid
``datetime.datetime`` object. ``datetime.datetime`` object.
@ -460,19 +460,19 @@ The ``max_value`` and ``min_value`` error messages may contain
Takes four optional arguments: Takes four optional arguments:
.. attribute:: DecimalField.max_value .. attribute:: max_value
.. attribute:: DecimalField.min_value .. attribute:: min_value
These control the range of values permitted in the field, and should be These control the range of values permitted in the field, and should be
given as ``decimal.Decimal`` values. given as ``decimal.Decimal`` values.
.. attribute:: DecimalField.max_digits .. attribute:: max_digits
The maximum number of digits (those before the decimal point plus those The maximum number of digits (those before the decimal point plus those
after the decimal point, with leading zeros stripped) permitted in the after the decimal point, with leading zeros stripped) permitted in the
value. value.
.. attribute:: DecimalField.decimal_places .. attribute:: decimal_places
The maximum number of decimal places permitted. The maximum number of decimal places permitted.
@ -539,18 +539,18 @@ length and ``%(length)d`` will be replaced with the current filename length.
The field allows choosing from files inside a certain directory. It takes three The field allows choosing from files inside a certain directory. It takes three
extra arguments; only ``path`` is required: extra arguments; only ``path`` is required:
.. attribute:: FilePathField.path .. attribute:: path
The absolute path to the directory whose contents you want listed. This The absolute path to the directory whose contents you want listed. This
directory must exist. directory must exist.
.. attribute:: FilePathField.recursive .. attribute:: recursive
If ``False`` (the default) only the direct contents of ``path`` will be If ``False`` (the default) only the direct contents of ``path`` will be
offered as choices. If ``True``, the directory will be descended into offered as choices. If ``True``, the directory will be descended into
recursively and all descendants will be listed as choices. recursively and all descendants will be listed as choices.
.. attribute:: FilePathField.match .. attribute:: match
A regular expression pattern; only files with names matching this expression A regular expression pattern; only files with names matching this expression
will be allowed as choices. will be allowed as choices.
@ -558,6 +558,8 @@ extra arguments; only ``path`` is required:
``FloatField`` ``FloatField``
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
.. class:: FloatField(**kwargs)
* Default widget: ``TextInput`` * Default widget: ``TextInput``
* Empty value: ``None`` * Empty value: ``None``
* Normalizes to: A Python float. * Normalizes to: A Python float.
@ -608,8 +610,8 @@ The ``max_value`` and ``min_value`` error messages may contain
Takes two optional arguments for validation: Takes two optional arguments for validation:
.. attribute:: IntegerField.max_value .. attribute:: max_value
.. attribute:: IntegerField.min_value .. attribute:: min_value
These control the range of values permitted in the field. These control the range of values permitted in the field.
@ -628,10 +630,10 @@ Takes two optional arguments for validation:
``GenericIPAddressField`` ``GenericIPAddressField``
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
.. class:: GenericIPAddressField(**kwargs)
.. versionadded:: 1.4 .. versionadded:: 1.4
.. class:: GenericIPAddressField(**kwargs)
A field containing either an IPv4 or an IPv6 address. A field containing either an IPv4 or an IPv6 address.
* Default widget: ``TextInput`` * Default widget: ``TextInput``
@ -649,13 +651,13 @@ are converted to lowercase.
Takes two optional arguments: Takes two optional arguments:
.. attribute:: GenericIPAddressField.protocol .. attribute:: protocol
Limits valid inputs to the specified protocol. Limits valid inputs to the specified protocol.
Accepted values are ``both`` (default), ``IPv4`` Accepted values are ``both`` (default), ``IPv4``
or ``IPv6``. Matching is case insensitive. or ``IPv6``. Matching is case insensitive.
.. attribute:: GenericIPAddressField.unpack_ipv4 .. attribute:: unpack_ipv4
Unpacks IPv4 mapped addresses like ``::ffff::192.0.2.1``. Unpacks IPv4 mapped addresses like ``::ffff::192.0.2.1``.
If this option is enabled that address would be unpacked to If this option is enabled that address would be unpacked to
@ -682,10 +684,10 @@ Takes one extra required argument, ``choices``, as for ``ChoiceField``.
``TypedMultipleChoiceField`` ``TypedMultipleChoiceField``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. class:: TypedMultipleChoiceField(**kwargs)
.. versionadded:: 1.3 .. versionadded:: 1.3
.. class:: TypedMultipleChoiceField(**kwargs)
Just like a :class:`MultipleChoiceField`, except :class:`TypedMultipleChoiceField` Just like a :class:`MultipleChoiceField`, except :class:`TypedMultipleChoiceField`
takes two extra arguments, ``coerce`` and ``empty_value``. takes two extra arguments, ``coerce`` and ``empty_value``.
@ -726,7 +728,7 @@ Takes two extra arguments, ``coerce`` and ``empty_value``, as for ``TypedChoiceF
Takes one required argument: Takes one required argument:
.. attribute:: RegexField.regex .. attribute:: regex
A regular expression specified either as a string or a compiled regular A regular expression specified either as a string or a compiled regular
expression object. expression object.
@ -768,7 +770,7 @@ This field is intended for use in representing a model
Takes one optional argument: Takes one optional argument:
.. attribute:: TimeField.input_formats .. attribute:: input_formats
A list of formats used to attempt to convert a string to a valid A list of formats used to attempt to convert a string to a valid
``datetime.time`` object. ``datetime.time`` object.
@ -791,22 +793,21 @@ If no ``input_formats`` argument is provided, the default input formats are::
Takes the following optional arguments: Takes the following optional arguments:
.. attribute:: URLField.max_length .. attribute:: max_length
.. attribute:: URLField.min_length .. attribute:: min_length
Same as ``CharField.max_length`` and ``CharField.min_length``. These are the same as ``CharField.max_length`` and ``CharField.min_length``.
.. attribute:: URLField.verify_exists .. attribute:: verify_exists
If ``True``, the validator will attempt to load the given URL, raising If ``True``, the validator will attempt to load the given URL, raising
``ValidationError`` if the page gives a 404. Defaults to ``False``. ``ValidationError`` if the page gives a 404. Defaults to ``False``.
.. deprecated:: 1.4 .. deprecated:: 1.4
``verify_exists`` was deprecated for security reasons and will be removed in ``verify_exists`` was deprecated for security reasons and will be removed in
Django 1.5. This deprecation also removes ``validator_user_agent``. Django 1.5. This deprecation also removes ``validator_user_agent``.
.. attribute:: URLField.validator_user_agent .. attribute:: validator_user_agent
String used as the user-agent used when checking for a URL's existence. String used as the user-agent used when checking for a URL's existence.
Defaults to the value of the :setting:`URL_VALIDATOR_USER_AGENT` setting. Defaults to the value of the :setting:`URL_VALIDATOR_USER_AGENT` setting.
@ -834,7 +835,7 @@ Slightly complex built-in ``Field`` classes
Takes one extra required argument: Takes one extra required argument:
.. attribute:: ComboField.fields .. attribute:: fields
The list of fields that should be used to validate the field's value (in The list of fields that should be used to validate the field's value (in
the order in which they are provided). the order in which they are provided).
@ -868,7 +869,7 @@ Takes one extra required argument:
Takes one extra required argument: Takes one extra required argument:
.. attribute:: MultiValueField.fields .. attribute:: fields
A list of fields which are cleaned into a single field. Each value in A list of fields which are cleaned into a single field. Each value in
``clean`` is cleaned by the corresponding field in ``fields`` -- the first ``clean`` is cleaned by the corresponding field in ``fields`` -- the first
@ -891,7 +892,7 @@ Takes one extra required argument:
Takes two optional arguments: Takes two optional arguments:
.. attribute:: SplitDateTimeField.input_date_formats .. attribute:: input_date_formats
A list of formats used to attempt to convert a string to a valid A list of formats used to attempt to convert a string to a valid
``datetime.date`` object. ``datetime.date`` object.
@ -899,7 +900,7 @@ Takes two optional arguments:
If no ``input_date_formats`` argument is provided, the default input formats If no ``input_date_formats`` argument is provided, the default input formats
for ``DateField`` are used. for ``DateField`` are used.
.. attribute:: SplitDateTimeField.input_time_formats .. attribute:: input_time_formats
A list of formats used to attempt to convert a string to a valid A list of formats used to attempt to convert a string to a valid
``datetime.time`` object. ``datetime.time`` object.
@ -933,7 +934,7 @@ objects (in the case of ``ModelMultipleChoiceField``) into the
Allows the selection of a single model object, suitable for Allows the selection of a single model object, suitable for
representing a foreign key. A single argument is required: representing a foreign key. A single argument is required:
.. attribute:: ModelChoiceField.queryset .. attribute:: queryset
A ``QuerySet`` of model objects from which the choices for the A ``QuerySet`` of model objects from which the choices for the
field will be derived, and which will be used to validate the field will be derived, and which will be used to validate the
@ -941,7 +942,7 @@ representing a foreign key. A single argument is required:
``ModelChoiceField`` also takes one optional argument: ``ModelChoiceField`` also takes one optional argument:
.. attribute:: ModelChoiceField.empty_label .. attribute:: empty_label
By default the ``<select>`` widget used by ``ModelChoiceField`` will have an By default the ``<select>`` widget used by ``ModelChoiceField`` will have an
empty choice at the top of the list. You can change the text of this empty choice at the top of the list. You can change the text of this
@ -988,7 +989,7 @@ representing a many-to-many relation. As with :class:`ModelChoiceField`,
you can use ``label_from_instance`` to customize the object you can use ``label_from_instance`` to customize the object
representations, and ``queryset`` is a required parameter: representations, and ``queryset`` is a required parameter:
.. attribute:: ModelMultipleChoiceField.queryset .. attribute:: queryset
A ``QuerySet`` of model objects from which the choices for the A ``QuerySet`` of model objects from which the choices for the
field will be derived, and which will be used to validate the field will be derived, and which will be used to validate the

View File

@ -21,9 +21,7 @@ which widget is used on which field, see the documentation about
However, if you want to use a different widget for a field, you can However, if you want to use a different widget for a field, you can
just use the :attr:`~Field.widget` argument on the field definition. For just use the :attr:`~Field.widget` argument on the field definition. For
example: example::
.. code-block:: python
from django import forms from django import forms
@ -42,9 +40,7 @@ Setting arguments for widgets
Many widgets have optional extra arguments; they can be set when defining the Many widgets have optional extra arguments; they can be set when defining the
widget on the field. In the following example, the widget on the field. In the following example, the
:attr:`~SelectDateWidget.years` attribute is set for a :attr:`~SelectDateWidget.years` attribute is set for a
:class:`~django.forms.extras.widgets.SelectDateWidget`: :class:`~django.forms.extras.widgets.SelectDateWidget`::
.. code-block:: python
from django.forms.fields import DateField, ChoiceField, MultipleChoiceField from django.forms.fields import DateField, ChoiceField, MultipleChoiceField
from django.forms.widgets import RadioSelect, CheckboxSelectMultiple from django.forms.widgets import RadioSelect, CheckboxSelectMultiple
@ -78,9 +74,7 @@ buttons.
:class:`Select` widgets are used by default on :class:`ChoiceField` fields. The :class:`Select` widgets are used by default on :class:`ChoiceField` fields. The
choices displayed on the widget are inherited from the :class:`ChoiceField` and choices displayed on the widget are inherited from the :class:`ChoiceField` and
changing :attr:`ChoiceField.choices` will update :attr:`Select.choices`. For changing :attr:`ChoiceField.choices` will update :attr:`Select.choices`. For
example: example::
.. code-block:: python
>>> from django import forms >>> from django import forms
>>> CHOICES = (('1', 'First',), ('2', 'Second',))) >>> CHOICES = (('1', 'First',), ('2', 'Second',)))
@ -113,9 +107,7 @@ specify additional attributes for each widget. When you specify a
widget, you can provide a list of attributes that will be added to the widget, you can provide a list of attributes that will be added to the
rendered HTML for the widget. rendered HTML for the widget.
For example, take the following simple form: For example, take the following simple form::
.. code-block:: python
from django import forms from django import forms
@ -126,9 +118,7 @@ For example, take the following simple form:
This form will include three default :class:`TextInput` widgets, with default This form will include three default :class:`TextInput` widgets, with default
rendering -- no CSS class, no extra attributes. This means that the input boxes rendering -- no CSS class, no extra attributes. This means that the input boxes
provided for each widget will be rendered exactly the same: provided for each widget will be rendered exactly the same::
.. code-block:: python
>>> f = CommentForm(auto_id=False) >>> f = CommentForm(auto_id=False)
>>> f.as_table() >>> f.as_table()
@ -136,15 +126,12 @@ provided for each widget will be rendered exactly the same:
<tr><th>Url:</th><td><input type="text" name="url"/></td></tr> <tr><th>Url:</th><td><input type="text" name="url"/></td></tr>
<tr><th>Comment:</th><td><input type="text" name="comment" /></td></tr> <tr><th>Comment:</th><td><input type="text" name="comment" /></td></tr>
On a real Web page, you probably don't want every widget to look the same. You On a real Web page, you probably don't want every widget to look the same. You
might want a larger input element for the comment, and you might want the might want a larger input element for the comment, and you might want the
'name' widget to have some special CSS class. To do this, you use the 'name' widget to have some special CSS class. To do this, you use the
:attr:`Widget.attrs` argument when creating the widget: :attr:`Widget.attrs` argument when creating the widget:
For example: For example::
.. code-block:: python
class CommentForm(forms.Form): class CommentForm(forms.Form):
name = forms.CharField( name = forms.CharField(
@ -155,8 +142,6 @@ For example:
Django will then include the extra attributes in the rendered output: Django will then include the extra attributes in the rendered output:
.. code-block:: python
>>> f = CommentForm(auto_id=False) >>> f = CommentForm(auto_id=False)
>>> f.as_table() >>> f.as_table()
<tr><th>Name:</th><td><input type="text" name="name" class="special"/></td></tr> <tr><th>Name:</th><td><input type="text" name="name" class="special"/></td></tr>
@ -411,9 +396,7 @@ commonly used groups of widgets:
:class:`MultiWidget`'s subclasses must implement. This method takes a :class:`MultiWidget`'s subclasses must implement. This method takes a
single "compressed" value and returns a ``list``. An example of this is how single "compressed" value and returns a ``list``. An example of this is how
:class:`SplitDateTimeWidget` turns a :class:`datetime` value into a list :class:`SplitDateTimeWidget` turns a :class:`datetime` value into a list
with date and time split into two seperate values: with date and time split into two seperate values::
.. code-block:: python
class SplitDateTimeWidget(MultiWidget): class SplitDateTimeWidget(MultiWidget):

View File

@ -62,9 +62,7 @@ Arguments sent with this signal:
A dictionary of keyword arguments passed to A dictionary of keyword arguments passed to
:meth:`~django.db.models.Model.__init__`:. :meth:`~django.db.models.Model.__init__`:.
For example, the :doc:`tutorial </intro/tutorial01>` has this line: For example, the :doc:`tutorial </intro/tutorial01>` has this line::
.. code-block:: python
p = Poll(question="What's up?", pub_date=datetime.now()) p = Poll(question="What's up?", pub_date=datetime.now())
@ -269,12 +267,11 @@ Arguments sent with this signal:
The database alias being used. The database alias being used.
For example, if a ``Pizza`` can have multiple ``Topping`` objects, modeled For example, if a ``Pizza`` can have multiple ``Topping`` objects, modeled
like this: like this::
.. code-block:: python
class Topping(models.Model): class Topping(models.Model):
# ... # ...
pass
class Pizza(models.Model): class Pizza(models.Model):
# ... # ...
@ -282,8 +279,6 @@ like this:
If we would do something like this: If we would do something like this:
.. code-block:: python
>>> p = Pizza.object.create(...) >>> p = Pizza.object.create(...)
>>> t = Topping.objects.create(...) >>> t = Topping.objects.create(...)
>>> p.toppings.add(t) >>> p.toppings.add(t)
@ -310,9 +305,7 @@ the arguments sent to a :data:`m2m_changed` handler would be:
``using`` ``"default"`` (since the default router sends writes here) ``using`` ``"default"`` (since the default router sends writes here)
============== ============================================================ ============== ============================================================
And if we would then do something like this: And if we would then do something like this::
.. code-block:: python
>>> t.pizza_set.remove(p) >>> t.pizza_set.remove(p)

View File

@ -308,7 +308,6 @@ This logging configuration does the following things:
message, plus the time, process, thread and module that message, plus the time, process, thread and module that
generate the log message. generate the log message.
* Defines one filter -- :class:`project.logging.SpecialFilter`, * Defines one filter -- :class:`project.logging.SpecialFilter`,
using the alias ``special``. If this filter required additional using the alias ``special``. If this filter required additional
arguments at time of construction, they can be provided as arguments at time of construction, they can be provided as