Removed unnecessary code-block directives.

This commit is contained in:
areski 2014-08-18 16:30:44 +02:00 committed by Tim Graham
parent fa02120d36
commit 9d6551204e
32 changed files with 161 additions and 308 deletions

View file

@ -554,9 +554,7 @@ Using a formset in views and templates
Using a formset inside a view is as easy as using a regular ``Form`` class.
The only thing you will want to be aware of is making sure to use the
management form inside the template. Let's look at a sample view:
.. code-block:: python
management form inside the template. Let's look at a sample view::
from django.forms.formsets import formset_factory
from django.shortcuts import render_to_response
@ -633,9 +631,7 @@ You are able to use more than one formset in a view if you like. Formsets
borrow much of its behavior from forms. With that said you are able to use
``prefix`` to prefix formset form field names with a given value to allow
more than one formset to be sent to a view without name clashing. Lets take
a look at how this might be accomplished:
.. code-block:: python
a look at how this might be accomplished::
from django.forms.formsets import formset_factory
from django.shortcuts import render_to_response

View file

@ -224,9 +224,7 @@ The :class:`Form` class
^^^^^^^^^^^^^^^^^^^^^^^
We already know what we want our HTML form to look like. Our starting point for
it in Django is this:
.. code-block:: python
it in Django is this::
from django import forms
@ -273,9 +271,7 @@ same view which published the form. This allows us to reuse some of the same
logic.
To handle the form we need to instantiate it in the view for the URL where we
want it to be published:
.. code-block:: python
want it to be published::
from django.shortcuts import render
from django.http import HttpResponseRedirect
@ -386,9 +382,7 @@ More on fields
--------------
Consider a more useful form than our minimal example above, which we could use
to implement "contact me" functionality on a personal Web site:
.. code-block:: python
to implement "contact me" functionality on a personal Web site::
from django import forms
@ -434,9 +428,7 @@ In the contact form example above, ``cc_myself`` will be a boolean value.
Likewise, fields such as :class:`IntegerField` and :class:`FloatField` convert
values to a Python ``int`` and ``float`` respectively.
Here's how the form data could be processed in the view that handles this form:
.. code-block:: python
Here's how the form data could be processed in the view that handles this form::
from django.core.mail import send_mail

View file

@ -851,7 +851,9 @@ Saving objects in the formset
-----------------------------
As with a ``ModelForm``, you can save the data as a model object. This is done
with the formset's ``save()`` method::
with the formset's ``save()`` method:
.. code-block:: python
# Create a formset instance with POST data.
>>> formset = AuthorFormSet(request.POST)
@ -869,7 +871,9 @@ excluded), these fields will not be set by the ``save()`` method. You can find
more information about this restriction, which also holds for regular
``ModelForms``, in `Selecting the fields to use`_.
Pass ``commit=False`` to return the unsaved model instances::
Pass ``commit=False`` to return the unsaved model instances:
.. code-block:: python
# don't save to the database
>>> instances = formset.save(commit=False)