mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #8979 -- Made a bunch of typo/formatting fixes to the docs. Thanks, ramiro
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
834a041e67
commit
74f386dba2
13 changed files with 78 additions and 40 deletions
|
@ -306,7 +306,9 @@ management form inside the template. Lets look at a sample view::
|
|||
formset = ArticleFormSet()
|
||||
return render_to_response('manage_articles.html', {'formset': formset})
|
||||
|
||||
The ``manage_articles.html`` template might look like this::
|
||||
The ``manage_articles.html`` template might look like this:
|
||||
|
||||
.. code-block:: html+django
|
||||
|
||||
<form method="POST" action="">
|
||||
{{ formset.management_form }}
|
||||
|
@ -318,7 +320,9 @@ The ``manage_articles.html`` template might look like this::
|
|||
</form>
|
||||
|
||||
However the above can be slightly shortcutted and let the formset itself deal
|
||||
with the management form::
|
||||
with the management form:
|
||||
|
||||
.. code-block:: html+django
|
||||
|
||||
<form method="POST" action="">
|
||||
<table>
|
||||
|
|
|
@ -10,6 +10,8 @@ Working with forms
|
|||
For a more detailed look at the forms API, see :ref:`ref-forms-api`. For
|
||||
documentation of the available field types, see :ref:`ref-forms-fields`.
|
||||
|
||||
.. highlightlang:: html+django
|
||||
|
||||
``django.forms`` is Django's form-handling library.
|
||||
|
||||
While it is possible to process form submissions just using Django's
|
||||
|
@ -60,7 +62,9 @@ make use of a declarative style that you'll be familiar with if you've used
|
|||
Django's database models.
|
||||
|
||||
For example, consider a form used to implement "contact me" functionality on a
|
||||
personal Web site::
|
||||
personal Web site:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django import forms
|
||||
|
||||
|
@ -82,7 +86,9 @@ description.
|
|||
Using a form in a view
|
||||
----------------------
|
||||
|
||||
The standard pattern for processing a form in a view looks like this::
|
||||
The standard pattern for processing a form in a view looks like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def contact(request):
|
||||
if request.method == 'POST': # If the form has been submitted...
|
||||
|
@ -133,7 +139,9 @@ also be converted in to the relevant Python types for you. In the above example,
|
|||
``cc_myself`` will be a boolean value. Likewise, fields such as ``IntegerField``
|
||||
and ``FloatField`` convert values to a Python int and float respectively.
|
||||
|
||||
Extending the above example, here's how the form data could be processed::
|
||||
Extending the above example, here's how the form data could be processed:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
if form.is_valid():
|
||||
subject = form.cleaned_data['subject']
|
||||
|
|
|
@ -36,7 +36,7 @@ from your ``INSTALLED_APPS``. It'll save you a small bit of overhead.
|
|||
Configuring the session engine
|
||||
==============================
|
||||
|
||||
.. versionadded:: 1.0.
|
||||
.. versionadded:: 1.0
|
||||
|
||||
By default, Django stores sessions in your database (using the model
|
||||
``django.contrib.sessions.models.Session``). Though this is convenient, in
|
||||
|
|
|
@ -395,7 +395,7 @@ obtain) the language translations themselves. Here's how that works.
|
|||
application) and English strings (from Django itself). If you want to
|
||||
support a locale for your application that is not already part of
|
||||
Django, you'll need to make at least a minimal translation of the Django
|
||||
core. See the relevant :ref:LocaleMiddleware note`<locale-middleware-notes>`
|
||||
core. See the relevant :ref:`LocaleMiddleware note<locale-middleware-notes>`
|
||||
for more details.
|
||||
|
||||
Message files
|
||||
|
|
|
@ -38,6 +38,8 @@ or CheetahTemplate_, you should feel right at home with Django's templates.
|
|||
Templates
|
||||
=========
|
||||
|
||||
.. highlightlang:: html+django
|
||||
|
||||
A template is simply a text file. It can generate any text-based format (HTML,
|
||||
XML, CSV, etc.).
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue