Commit d1e5c552 authored by Luke Plant's avatar Luke Plant
Browse files

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
parent 5109ac37
Loading
Loading
Loading
Loading
+36 −48
Original line number Diff line number Diff line
@@ -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
    local variables susceptible to contain sensitive information, you may
    prevent the values of those variables from being included in error reports
    using the ``sensitive_variables`` decorator:

        .. code-block:: python
    using the ``sensitive_variables`` decorator::

        from django.views.decorators.debug import sensitive_variables

@@ -163,9 +161,7 @@ production environment (that is, where :setting:`DEBUG` is set to ``False``):
    disclosed.

    To systematically hide all local variables of a function from error logs,
    do not provide any argument to the ``sensitive_variables`` decorator:

        .. code-block:: python
    do not provide any argument to the ``sensitive_variables`` decorator::

        @sensitive_variables()
        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
    information, you may prevent the values of those parameters from being
    included in the error reports using the ``sensitive_post_parameters``
    decorator:

        .. code-block:: python
    decorator::

        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.

    To systematically hide all POST parameters of a request in error reports,
    do not provide any argument to the ``sensitive_post_parameters`` decorator:

        .. code-block:: python
    do not provide any argument to the ``sensitive_post_parameters`` decorator::

        @sensitive_post_parameters()
        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
customize this default behavior for your entire site, you need to define your
own filter class and tell Django to use it via the
:setting:`DEFAULT_EXCEPTION_REPORTER_FILTER` setting:

    .. code-block:: python
:setting:`DEFAULT_EXCEPTION_REPORTER_FILTER` setting::

    DEFAULT_EXCEPTION_REPORTER_FILTER = 'path.to.your.CustomExceptionReporterFilter'

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``
attribute:

    .. code-block:: python
attribute::

    def my_view(request):
        if request.user.is_authenticated():
+121 −117
Original line number Diff line number Diff line
@@ -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
    :doc:`patch<writing-code/submitting-patches>`. These will be reviewed
    to see if the patch is "good".

* Needs documentation:
    This flag is used for tickets with patches that need associated
    documentation. Complete documentation of features is a prerequisite
    before we can check them into the codebase.

* Needs tests
    This flags the patch as needing associated unit tests. Again, this
    is a required part of a valid patch.

* Patch needs improvement
    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
    cleanly, there is a flaw in the implementation, or that the code
    doesn't meet our standards.

* Easy pickings
    Tickets that would require small, easy, patches.

+230 −229
Original line number Diff line number Diff line
@@ -324,8 +324,8 @@ For each field, we describe the default widget used if you don't specify

    Has two optional arguments for validation:

.. attribute:: CharField.max_length
.. attribute:: CharField.min_length
    .. attribute:: max_length
    .. attribute:: min_length

    If provided, these arguments ensure that the string is at most or at least
    the given length.
@@ -346,7 +346,7 @@ replaced with the selected choice.

    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
        field. This argument accepts the same formats as the ``choices`` argument
@@ -370,13 +370,13 @@ extra arguments, ``coerce`` and ``empty_value``.

    Takes extra arguments:

.. attribute:: TypedChoiceField.coerce
    .. attribute:: coerce

        A function that takes one argument and returns a coerced value. Examples
        include the built-in ``int``, ``float``, ``bool`` and other types. Defaults
        to an identity function.

.. attribute:: TypedChoiceField.empty_value
    .. attribute:: empty_value

        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
@@ -397,7 +397,7 @@ Takes extra arguments:

    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
        ``datetime.date`` object.
@@ -424,7 +424,7 @@ If no ``input_formats`` argument is provided, the default input formats are::

    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
        ``datetime.datetime`` object.
@@ -460,19 +460,19 @@ The ``max_value`` and ``min_value`` error messages may contain

    Takes four optional arguments:

.. attribute:: DecimalField.max_value
.. attribute:: DecimalField.min_value
    .. attribute:: max_value
    .. attribute:: min_value

        These control the range of values permitted in the field, and should be
        given as ``decimal.Decimal`` values.

.. attribute:: DecimalField.max_digits
    .. attribute:: max_digits

        The maximum number of digits (those before the decimal point plus those
        after the decimal point, with leading zeros stripped) permitted in the
        value.

.. attribute:: DecimalField.decimal_places
    .. attribute:: decimal_places

        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
    extra arguments; only ``path`` is required:

.. attribute:: FilePathField.path
    .. attribute:: path

        The absolute path to the directory whose contents you want listed. This
        directory must exist.

.. attribute:: FilePathField.recursive
    .. attribute:: recursive

        If ``False`` (the default) only the direct contents of ``path`` will be
        offered as choices. If ``True``, the directory will be descended into
        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
        will be allowed as choices.
@@ -558,6 +558,8 @@ extra arguments; only ``path`` is required:
``FloatField``
~~~~~~~~~~~~~~

.. class:: FloatField(**kwargs)

    * Default widget: ``TextInput``
    * Empty value: ``None``
    * 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:

.. attribute:: IntegerField.max_value
.. attribute:: IntegerField.min_value
    .. attribute:: max_value
    .. attribute:: min_value

    These control the range of values permitted in the field.

@@ -628,10 +630,10 @@ Takes two optional arguments for validation:
``GenericIPAddressField``
~~~~~~~~~~~~~~~~~~~~~~~~~

.. class:: GenericIPAddressField(**kwargs)

.. versionadded:: 1.4

.. class:: GenericIPAddressField(**kwargs)

    A field containing either an IPv4 or an IPv6 address.

    * Default widget: ``TextInput``
@@ -649,13 +651,13 @@ are converted to lowercase.

    Takes two optional arguments:

.. attribute:: GenericIPAddressField.protocol
    .. attribute:: protocol

        Limits valid inputs to the specified protocol.
        Accepted values are ``both`` (default), ``IPv4``
        or ``IPv6``. Matching is case insensitive.

.. attribute:: GenericIPAddressField.unpack_ipv4
    .. attribute:: unpack_ipv4

        Unpacks IPv4 mapped addresses like ``::ffff::192.0.2.1``.
        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``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. class:: TypedMultipleChoiceField(**kwargs)

.. versionadded:: 1.3

.. class:: TypedMultipleChoiceField(**kwargs)

    Just like a :class:`MultipleChoiceField`, except :class:`TypedMultipleChoiceField`
    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:

.. attribute:: RegexField.regex
    .. attribute:: regex

        A regular expression specified either as a string or a compiled regular
        expression object.
@@ -768,7 +770,7 @@ This field is intended for use in representing a model

    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
        ``datetime.time`` object.
@@ -791,22 +793,21 @@ If no ``input_formats`` argument is provided, the default input formats are::

    Takes the following optional arguments:

.. attribute:: URLField.max_length
.. attribute:: URLField.min_length
    .. attribute:: max_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
        ``ValidationError`` if the page gives a 404. Defaults to ``False``.

        .. deprecated:: 1.4

            ``verify_exists`` was deprecated for security reasons and will be removed in
            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.
        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:

.. attribute:: ComboField.fields
    .. attribute:: fields

        The list of fields that should be used to validate the field's value (in
        the order in which they are provided).
@@ -868,7 +869,7 @@ 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
        ``clean`` is cleaned by the corresponding field in ``fields`` -- the first
@@ -891,7 +892,7 @@ Takes one extra required argument:

    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
        ``datetime.date`` object.
@@ -899,7 +900,7 @@ Takes two optional arguments:
    If no ``input_date_formats`` argument is provided, the default input formats
    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
        ``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
    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
        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:

.. attribute:: ModelChoiceField.empty_label
    .. attribute:: empty_label

        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
@@ -988,7 +989,7 @@ representing a many-to-many relation. As with :class:`ModelChoiceField`,
    you can use ``label_from_instance`` to customize the object
    representations, and ``queryset`` is a required parameter:

.. attribute:: ModelMultipleChoiceField.queryset
    .. attribute:: queryset

        A ``QuerySet`` of model objects from which the choices for the
        field will be derived, and which will be used to validate the
+57 −74
Original line number Diff line number Diff line
@@ -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
just use the :attr:`~Field.widget` argument on the field definition. For
example:

    .. code-block:: python
example::

    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
widget on the field. In the following example, the
:attr:`~SelectDateWidget.years` attribute is set for a
:class:`~django.forms.extras.widgets.SelectDateWidget`:

    .. code-block:: python
:class:`~django.forms.extras.widgets.SelectDateWidget`::

    from django.forms.fields import DateField, ChoiceField, MultipleChoiceField
    from django.forms.widgets import RadioSelect, CheckboxSelectMultiple
@@ -78,9 +74,7 @@ buttons.
:class:`Select` widgets are used by default on :class:`ChoiceField` fields. The
choices displayed on the widget are inherited from the :class:`ChoiceField` and
changing :attr:`ChoiceField.choices` will update :attr:`Select.choices`. For
example:

    .. code-block:: python
example::

    >>> from django import forms
    >>> 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
rendered HTML for the widget.

For example, take the following simple form:

    .. code-block:: python
For example, take the following simple form::

    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
rendering -- no CSS class, no extra attributes. This means that the input boxes
provided for each widget will be rendered exactly the same:

    .. code-block:: python
provided for each widget will be rendered exactly the same::

    >>> f = CommentForm(auto_id=False)
    >>> 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>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
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
:attr:`Widget.attrs` argument when creating the widget:

For example:

    .. code-block:: python
For example::

    class CommentForm(forms.Form):
        name = forms.CharField(
@@ -155,8 +142,6 @@ For example:

Django will then include the extra attributes in the rendered output:

    .. code-block:: python

    >>> f = CommentForm(auto_id=False)
    >>> f.as_table()
    <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
    single "compressed" value and returns a ``list``. An example of this is how
    :class:`SplitDateTimeWidget` turns a :class:`datetime` value into a list
    with date and time split into two seperate values:

    .. code-block:: python
    with date and time split into two seperate values::

        class SplitDateTimeWidget(MultiWidget):

+39 −46
Original line number Diff line number Diff line
@@ -62,9 +62,7 @@ Arguments sent with this signal:
    A dictionary of keyword arguments passed to
    :meth:`~django.db.models.Model.__init__`:.

For example, the :doc:`tutorial </intro/tutorial01>` has this line:

.. code-block:: python
For example, the :doc:`tutorial </intro/tutorial01>` has this line::

    p = Poll(question="What's up?", pub_date=datetime.now())

@@ -269,12 +267,11 @@ Arguments sent with this signal:
    The database alias being used.

For example, if a ``Pizza`` can have multiple ``Topping`` objects, modeled
like this:

.. code-block:: python
like this::

    class Topping(models.Model):
        # ...
        pass

    class Pizza(models.Model):
        # ...
@@ -282,8 +279,6 @@ like this:

If we would do something like this:

.. code-block:: python

    >>> p = Pizza.object.create(...)
    >>> t = Topping.objects.create(...)
    >>> 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)
==============  ============================================================

And if we would then do something like this:

.. code-block:: python
And if we would then do something like this::

    >>> t.pizza_set.remove(p)

Loading