summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-04 05:45:17 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-04 05:45:17 +0000
commit0a9b7519582bc358be10bb374bfbdfe237e09578 (patch)
tree53cd8b31532dab0bf97bda74589e34a1b615b9f3 /docs
parenta4343209db3473b09aecc707cea522455c8218cc (diff)
queryset-refactor: Merged changes from trunk up to [7085].
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7086 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/i18n.txt8
-rw-r--r--docs/localflavor.txt19
-rw-r--r--docs/modelforms.txt17
-rw-r--r--docs/request_response.txt9
-rw-r--r--docs/shortcuts.txt17
5 files changed, 58 insertions, 12 deletions
diff --git a/docs/i18n.txt b/docs/i18n.txt
index 1ae3024157..78404d4503 100644
--- a/docs/i18n.txt
+++ b/docs/i18n.txt
@@ -292,6 +292,14 @@ translation string. Example::
In this case, both the tag and the filter will see the already-translated
string, so they don't need to be aware of translations.
+.. note::
+ In this example, the translation infrastructure will be passed the string
+ ``"yes,no"``, not the individual strings ``"yes"`` and ``"no"``. The
+ translated string will need to contain the comma so that the filter
+ parsing code knows how to split up the arguments. For example, a German
+ translator might translate the string ``"yes,no"`` as ``"ja,nein"``
+ (keeping the comma intact).
+
.. _Django templates: ../templates_python/
Working with lazy translation objects
diff --git a/docs/localflavor.txt b/docs/localflavor.txt
index 75ec95382e..5a2e5b8fda 100644
--- a/docs/localflavor.txt
+++ b/docs/localflavor.txt
@@ -113,10 +113,23 @@ postal code or a CPA_.
.. _CPA: http://www.correoargentino.com.ar/consulta_cpa/home.php
+ARDNIField
+----------
+
+A form field that validates input as a Documento Nacional de Identidad (DNI)
+number.
+
+ARCUITField
+-----------
+
+A form field that validates input as a Código Único de Identificación
+Tributaria (CUIT) number.
+
ARProvinceSelect
----------------
-A ``Select`` widget that uses a list of Argentina's provinces as its choices.
+A ``Select`` widget that uses a list of Argentina's provinces and autonomous
+cities as its choices.
Australia (``django.contrib.localflavor.au``)
=============================================
@@ -610,7 +623,7 @@ UKNationSelect
A ``Select`` widget that uses a list of UK nations as its choices.
-United States of America (``django.contrib.localflavor.us``)
+United States of America (``django.contrib.localflavor.us``)
============================================================
USPhoneNumberField
@@ -635,7 +648,7 @@ A valid SSN must obey the following rules:
USStateField
------------
-A form field that validates input as a U.S. state name or abbreviation. It
+A form field that validates input as a U.S. state name or abbreviation. It
normalizes the input to the standard two-letter postal service abbreviation
for the given state.
diff --git a/docs/modelforms.txt b/docs/modelforms.txt
index 0136540bed..a99e27fff7 100644
--- a/docs/modelforms.txt
+++ b/docs/modelforms.txt
@@ -17,7 +17,7 @@ class from a Django model.
For example::
>>> from django.newforms import ModelForm
-
+
# Create the form class.
>>> class ArticleForm(ModelForm):
... class Meta:
@@ -113,7 +113,7 @@ In addition, each generated form field has attributes set as follows:
``default`` value will be initially selected instead).
Finally, note that you can override the form field used for a given model
-field. See "Overriding the default field types" below.
+field. See `Overriding the default field types`_ below.
A full example
--------------
@@ -278,7 +278,7 @@ model fields:
To avoid this failure, you must instantiate your model with initial values
for the missing, but required fields, or use ``save(commit=False)`` and
manually set any extra required fields::
-
+
instance = Instance(required_field='value')
form = InstanceForm(request.POST, instance=instance)
new_instance = form.save()
@@ -295,7 +295,7 @@ model fields:
Overriding the default field types
----------------------------------
-The default field types, as described in the "Field types" table above, are
+The default field types, as described in the `Field types`_ table above, are
sensible defaults. If you have a ``DateField`` in your model, chances are you'd
want that to be represented as a ``DateField`` in your form. But
``ModelForm`` gives you the flexibility of changing the form field type
@@ -311,3 +311,12 @@ field, you could do the following::
...
... class Meta:
... model = Article
+
+If you want to override a field's default widget, then specify the ``widget``
+parameter when declaring the form field::
+
+ >>> class ArticleForm(ModelForm):
+ ... pub_date = DateField(widget=MyDateWidget())
+ ...
+ ... class Meta:
+ ... model = Article
diff --git a/docs/request_response.txt b/docs/request_response.txt
index e3d794c9ba..47c66355e8 100644
--- a/docs/request_response.txt
+++ b/docs/request_response.txt
@@ -575,6 +575,10 @@ Three things to note about 404 views:
to the template: ``request_path``, which is the URL that resulted
in the 404.
+ * The 404 view is passed a ``RequestContext`` and will have access to
+ variables supplied by your ``TEMPLATE_CONTEXT_PROCESSORS`` (e.g.
+ ``MEDIA_URL``).
+
* If ``DEBUG`` is set to ``True`` (in your settings module), then your 404
view will never be used, and the traceback will be displayed instead.
@@ -587,8 +591,9 @@ the view ``django.views.defaults.server_error``, which loads and renders the
template ``500.html``.
This means you need to define a ``500.html`` template in your root template
-directory. This template will be used for all server errors. The
-default 500 view passes no variables to this template.
+directory. This template will be used for all server errors. The default 500
+view passes no variables to this template and is rendered with an empty
+``Context`` to lessen the chance of additional errors.
This ``server_error`` view should suffice for 99% of Web applications, but if
you want to override the view, you can specify ``handler500`` in your
diff --git a/docs/shortcuts.txt b/docs/shortcuts.txt
index 19eac4be6d..f1d7f38ffa 100644
--- a/docs/shortcuts.txt
+++ b/docs/shortcuts.txt
@@ -22,16 +22,29 @@ Required arguments
Optional arguments
------------------
-``context``
+``dictionary``
A dictionary of values to add to the template context. By default, this
is an empty dictionary. If a value in the dictionary is callable, the
view will call it just before rendering the template.
+``context_instance``
+ The context instance to render the template with. By default, the template
+ will be rendered with a ``Context`` instance (filled with values from
+ ``dictionary``). If you need to use `context processors`_, you will want to
+ render the template with a ``RequestContext`` instance instead. Your code
+ might look something like this::
+
+ return render_to_response('my_template.html',
+ my_data_dictionary,
+ context_instance=RequestContext(request))
+
``mimetype``
**New in Django development version:** The MIME type to use for the
resulting document. Defaults to the value of the ``DEFAULT_CONTENT_TYPE``
setting.
+.. _`context processors`: ../templates_python/#subclassing-context-requestcontext
+
Example
-------
@@ -57,8 +70,6 @@ This example is equivalent to::
r = HttpResponse(t.render(c),
mimetype="application/xhtml+xml")
-.. _an HttpResponse object: ../request_response/#httpresponse-objects
-
``get_object_or_404``
=====================