summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/add_ons.txt12
-rw-r--r--docs/authentication.txt4
-rw-r--r--docs/custom_model_fields.txt4
-rw-r--r--docs/django-admin.txt11
-rw-r--r--docs/form_for_model.txt7
-rw-r--r--docs/localflavor.txt214
-rw-r--r--docs/middleware.txt28
-rw-r--r--docs/modelforms.txt4
-rw-r--r--docs/request_response.txt14
-rw-r--r--docs/sessions.txt2
-rw-r--r--docs/settings.txt9
-rw-r--r--docs/sites.txt6
-rw-r--r--docs/syndication_feeds.txt2
-rw-r--r--docs/templates_python.txt4
-rw-r--r--docs/testing.txt49
15 files changed, 212 insertions, 158 deletions
diff --git a/docs/add_ons.txt b/docs/add_ons.txt
index c6fdb4a3a2..029e314f12 100644
--- a/docs/add_ons.txt
+++ b/docs/add_ons.txt
@@ -47,7 +47,11 @@ contenttypes
============
A light framework for hooking into "types" of content, where each installed
-Django model is a separate content type. This is not yet documented.
+Django model is a separate content type.
+
+See the `contenttypes documentation`_.
+
+.. _contenttypes documentation: ../contenttypes/
csrf
====
@@ -177,9 +181,13 @@ localflavor
===========
A collection of various Django snippets that are useful only for a particular
-country or culture. For example, ``django.contrib.localflavor.usa.forms``
+country or culture. For example, ``django.contrib.localflavor.us.forms``
contains a ``USZipCodeField`` that you can use to validate U.S. zip codes.
+See the `localflavor documentation`_.
+
+.. _localflavor documentation: ../localflavor/
+
markup
======
diff --git a/docs/authentication.txt b/docs/authentication.txt
index 8f305ba4d1..5134e90267 100644
--- a/docs/authentication.txt
+++ b/docs/authentication.txt
@@ -247,8 +247,8 @@ Anonymous users
the ``django.contrib.auth.models.User`` interface, with these differences:
* ``id`` is always ``None``.
- * ``is_staff`` and ``is_superuser`` are always False.
- * ``is_active`` is always True.
+ * ``is_staff`` and ``is_superuser`` are always ``False``.
+ * ``is_active`` is always ``False``.
* ``groups`` and ``user_permissions`` are always empty.
* ``is_anonymous()`` returns ``True`` instead of ``False``.
* ``is_authenticated()`` returns ``False`` instead of ``True``.
diff --git a/docs/custom_model_fields.txt b/docs/custom_model_fields.txt
index 80c9de7d16..923b331a95 100644
--- a/docs/custom_model_fields.txt
+++ b/docs/custom_model_fields.txt
@@ -44,8 +44,8 @@ Our class looks something like this::
# ... (other possibly useful methods omitted) ...
This is just an ordinary Python class, with nothing Django-specific about it.
-We'd like to be able to things like this in our models (we assume the ``hand``
-attribute on the model is an instance of ``Hand``)::
+We'd like to be able to do things like this in our models (we assume the
+``hand`` attribute on the model is an instance of ``Hand``)::
example = MyModel.objects.get(pk=1)
print example.hand.north
diff --git a/docs/django-admin.txt b/docs/django-admin.txt
index 2977f9908f..21821ab2e9 100644
--- a/docs/django-admin.txt
+++ b/docs/django-admin.txt
@@ -132,6 +132,13 @@ If no application name is provided, all installed applications will be dumped.
The output of ``dumpdata`` can be used as input for ``loaddata``.
+Note that ``dumpdata`` uses the default manager on the model for selecting the
+records to dump. If you're using a `custom manager`_ as the default manager
+and it filters some of the available records, not all of the objects will be
+dumped.
+
+.. _custom manager: ../model-api/#custom-managers
+
--format
~~~~~~~~
@@ -709,8 +716,8 @@ in Python package syntax, e.g. ``mysite.settings``. If this isn't provided,
``django-admin.py`` will use the ``DJANGO_SETTINGS_MODULE`` environment
variable.
-Note that this option is unnecessary in ``manage.py``, because it takes care of
-setting ``DJANGO_SETTINGS_MODULE`` for you.
+Note that this option is unnecessary in ``manage.py``, because it uses
+``settings.py`` from the current project by default.
Extra niceties
==============
diff --git a/docs/form_for_model.txt b/docs/form_for_model.txt
index 6761c15331..ddca9aae18 100644
--- a/docs/form_for_model.txt
+++ b/docs/form_for_model.txt
@@ -1,6 +1,13 @@
Generating forms for models
===========================
+.. admonition:: Note
+
+ The APIs described in this document have been deprecated. If you're
+ developing new code, use `ModelForms`_ instead.
+
+.. _ModelForms: ../modelforms/
+
If you're building a database-driven app, chances are you'll have forms that
map closely to Django models. For instance, you might have a ``BlogComment``
model, and you want to create a form that lets people submit comments. In this
diff --git a/docs/localflavor.txt b/docs/localflavor.txt
index 3eecba57e7..fc227fee28 100644
--- a/docs/localflavor.txt
+++ b/docs/localflavor.txt
@@ -2,16 +2,22 @@
The "local flavor" add-ons
==========================
-Django comes with assorted pieces of code that are useful only for a particular
-country or culture. These pieces of code are organized as a set of
-subpackages, named using `ISO 3166 country codes`_.
+Following its "batteries included" philosophy, Django comes with assorted
+pieces of code that are useful for particular countries or cultures. These are
+called the "local flavor" add-ons and live in the ``django.contrib.localflavor``
+package.
-.. _ISO 3166 country codes: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
+Inside that package, country- or culture-specific code is organized into
+subpackages, named using `ISO 3166 country codes`_.
Most of the ``localflavor`` add-ons are localized form components deriving from
-the newforms_ framework. To use one of these localized components, just import
-the relevant subpackage. For example, a form with a field for French telephone
-numbers is created like so::
+the newforms_ framework -- for example, a ``USStateField`` that knows how to
+validate U.S. state abbreviations, and a ``FISocialSecurityNumber`` that knows
+how to validate Finnish social security numbers.
+
+To use one of these localized components, just import the relevant subpackage.
+For example, here's how you can create a form with a field representing a
+French telephone number::
from django import newforms as forms
from django.contrib.localflavor import fr
@@ -19,32 +25,48 @@ numbers is created like so::
class MyForm(forms.Form):
my_french_phone_no = fr.forms.FRPhoneNumberField()
+Supported countries
+===================
+
Countries currently supported by ``localflavor`` are:
-* Argentina_
-* Australia_
-* Brazil_
-* Canada_
-* Chile_
-* Finland_
-* France_
-* Germany_
-* Holland_
-* Iceland_
-* India_
-* Italy_
-* Japan_
-* Mexico_
-* Norway_
-* Peru_
-* Poland_
-* Slovakia_
-* `South Africa`_
-* Spain_
-* Switzerland_
-* `United Kingdom`_
-* `United States of America`_
+ * Argentina_
+ * Australia_
+ * Brazil_
+ * Canada_
+ * Chile_
+ * Finland_
+ * France_
+ * Germany_
+ * Holland_
+ * Iceland_
+ * India_
+ * Italy_
+ * Japan_
+ * Mexico_
+ * Norway_
+ * Peru_
+ * Poland_
+ * Slovakia_
+ * `South Africa`_
+ * Spain_
+ * Switzerland_
+ * `United Kingdom`_
+ * `United States of America`_
+
+The ``localflavor`` package also includes a ``generic`` subpackage, containing
+useful code that is not specific to one particular country or culture.
+Currently, it defines date and datetime input fields based on those from
+newforms_, but with non-US default formats. Here's an example of how to use
+them::
+
+ from django import newforms as forms
+ from django.contrib.localflavor import generic
+
+ class MyForm(forms.Form):
+ my_date_field = generic.forms.DateField()
+.. _ISO 3166 country codes: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
.. _Argentina: `Argentina (django.contrib.localflavor.ar)`_
.. _Australia: `Australia (django.contrib.localflavor.au)`_
.. _Brazil: `Brazil (django.contrib.localflavor.br)`_
@@ -68,29 +90,15 @@ Countries currently supported by ``localflavor`` are:
.. _Switzerland: `Switzerland (django.contrib.localflavor.ch)`_
.. _United Kingdom: `United Kingdom (django.contrib.localflavor.uk)`_
.. _United States of America: `United States of America (django.contrib.localflavor.us)`_
-
-The ``localflavor`` add-on also includes the ``generic`` subpackage, containing
-useful code that is not specific to one particular country or culture.
-Currently, it defines date and date & time input fields based on those from
-newforms_, but with non-US default formats. Here's an example of how to use
-them::
-
- from django import newforms as forms
- from django.contrib.localflavor import generic
-
- class MyForm(forms.Form):
- my_date_field = generic.forms.DateField()
-
.. _newforms: ../newforms/
+Adding flavors
+==============
-.. admonition:: Adding a Flavor
-
- We'd love to add more of these to Django, so please create a ticket for
- anything that you've found useful. Please use unicode objects
- (``u'mystring'``) for strings, rather than setting the encoding in the file
- (see any of the existing flavors for examples).
-
+We'd love to add more of these to Django, so please `create a ticket`_ with
+any code you'd like to contribute. One thing we ask is that you please use
+Unicode objects (``u'mystring'``) for strings, rather than setting the encoding
+in the file. See any of the existing flavors for examples.
Argentina (``django.contrib.localflavor.ar``)
=============================================
@@ -108,7 +116,6 @@ ARProvinceSelect
A ``Select`` widget that uses a list of Argentina's provinces as its choices.
-
Australia (``django.contrib.localflavor.au``)
=============================================
@@ -129,7 +136,6 @@ AUStateSelect
A ``Select`` widget that uses a list of Australian states/territories as its
choices.
-
Brazil (``django.contrib.localflavor.br``)
==========================================
@@ -151,7 +157,6 @@ BRStateSelect
A ``Select`` widget that uses a list of Brazilian states/territories as its
choices.
-
Canada (``django.contrib.localflavor.ca``)
==========================================
@@ -176,7 +181,7 @@ CASocialInsuranceNumberField
----------------------------
A form field that validates input as a Canadian Social Insurance Number (SIN).
-A valid number must have the format XXX-XXX-XXXX and pass a `Luhn mod-10
+A valid number must have the format XXX-XXX-XXX and pass a `Luhn mod-10
checksum`_.
.. _Luhn mod-10 checksum: http://en.wikipedia.org/wiki/Luhn_algorithm
@@ -187,7 +192,6 @@ CAProvinceSelect
A ``Select`` widget that uses a list of Canadian provinces and territories as
its choices.
-
Chile (``django.contrib.localflavor.cl``)
=========================================
@@ -203,7 +207,6 @@ CLRegionSelect
A ``Select`` widget that uses a list of Chilean regions (Regiones) as its
choices.
-
Finland (``django.contrib.localflavor.fi``)
===========================================
@@ -215,7 +218,7 @@ A form field that validates input as a Finnish social security number.
FIZipCodeField
--------------
-A form field that validates input as a Finnish zip code. Valid codes
+A form field that validates input as a Finnish zip code. Valid codes
consist of five digits.
FIMunicipalitySelect
@@ -224,7 +227,6 @@ FIMunicipalitySelect
A ``Select`` widget that uses a list of Finnish municipalities as its
choices.
-
France (``django.contrib.localflavor.fr``)
==========================================
@@ -232,13 +234,13 @@ FRPhoneNumberField
------------------
A form field that validates input as a French local phone number. The
-correct format is 0X XX XX XX XX. 0X.XX.XX.XX.XX and 0XXXXXXXXX validate
+correct format is 0X XX XX XX XX. 0X.XX.XX.XX.XX and 0XXXXXXXXX validate
but are corrected to 0X XX XX XX XX.
FRZipCodeField
--------------
-A form field that validates input as a French zip code. Valid codes
+A form field that validates input as a French zip code. Valid codes
consist of five digits.
FRDepartmentSelect
@@ -246,7 +248,6 @@ FRDepartmentSelect
A ``Select`` widget that uses a list of French departments as its choices.
-
Germany (``django.contrib.localflavor.de``)
===========================================
@@ -254,7 +255,7 @@ DEIdentityCardNumberField
-------------------------
A form field that validates input as a German identity card number
-(Personalausweis_). Valid numbers have the format
+(Personalausweis_). Valid numbers have the format
XXXXXXXXXXX-XXXXXXX-XXXXXXX-X, with no group consisting entirely of zeroes.
.. _Personalausweis: http://de.wikipedia.org/wiki/Personalausweis
@@ -262,7 +263,7 @@ XXXXXXXXXXX-XXXXXXX-XXXXXXX-X, with no group consisting entirely of zeroes.
DEZipCodeField
--------------
-A form field that validates input as a German zip code. Valid codes
+A form field that validates input as a German zip code. Valid codes
consist of five digits.
DEStateSelect
@@ -270,7 +271,6 @@ DEStateSelect
A ``Select`` widget that uses a list of German states as its choices.
-
Holland (``django.contrib.localflavor.nl``)
===========================================
@@ -296,7 +296,6 @@ NLProvinceSelect
A ``Select`` widget that uses a list of Dutch provinces as its list of
choices.
-
Iceland (``django.contrib.localflavor.is_``)
============================================
@@ -304,7 +303,7 @@ ISIdNumberField
---------------
A form field that validates input as an Icelandic identification number
-(kennitala). The format is XXXXXX-XXXX.
+(kennitala). The format is XXXXXX-XXXX.
ISPhoneNumberField
------------------
@@ -318,7 +317,6 @@ ISPostalCodeSelect
A ``Select`` widget that uses a list of Icelandic postal codes as its
choices.
-
India (``django.contrib.localflavor.in_``)
==========================================
@@ -326,7 +324,7 @@ INStateField
------------
A form field that validates input as an Indian state/territory name or
-abbreviation. Input is normalized to the standard two-letter vehicle
+abbreviation. Input is normalized to the standard two-letter vehicle
registration abbreviation for the given state or territory.
INZipCodeField
@@ -341,7 +339,6 @@ INStateSelect
A ``Select`` widget that uses a list of Indian states/territories as its
choices.
-
Italy (``django.contrib.localflavor.it``)
=========================================
@@ -361,7 +358,7 @@ A form field that validates Italian VAT numbers (partita IVA).
ITZipCodeField
--------------
-A form field that validates input as an Italian zip code. Valid codes
+A form field that validates input as an Italian zip code. Valid codes
must have five digits.
ITProvinceSelect
@@ -374,22 +371,20 @@ ITRegionSelect
A ``Select`` widget that uses a list of Italian regions as its choices.
-
Japan (``django.contrib.localflavor.jp``)
=========================================
JPPostalCodeField
-----------------
-A form field that validates input as a Japanese postcode.
-It accepts seven digits, with or without a hyphen.
+A form field that validates input as a Japanese postcode. It accepts seven
+digits, with or without a hyphen.
JPPrefectureSelect
------------------
A ``Select`` widget that uses a list of Japanese prefectures as its choices.
-
Mexico (``django.contrib.localflavor.mx``)
==========================================
@@ -398,7 +393,6 @@ MXStateSelect
A ``Select`` widget that uses a list of Mexican states as its choices.
-
Norway (``django.contrib.localflavor.no``)
==========================================
@@ -413,7 +407,7 @@ A form field that validates input as a Norwegian social security number
NOZipCodeField
--------------
-A form field that validates input as a Norwegian zip code. Valid codes
+A form field that validates input as a Norwegian zip code. Valid codes
have four digits.
NOMunicipalitySelect
@@ -422,7 +416,6 @@ NOMunicipalitySelect
A ``Select`` widget that uses a list of Norwegian municipalities (fylker) as
its choices.
-
Peru (``django.contrib.localflavor.pe``)
========================================
@@ -436,14 +429,13 @@ PERUCField
----------
A form field that validates input as an RUC (Registro Unico de
-Contribuyentes) number. Valid RUC numbers have eleven digits.
+Contribuyentes) number. Valid RUC numbers have 11 digits.
PEDepartmentSelect
------------------
A ``Select`` widget that uses a list of Peruvian Departments as its choices.
-
Poland (``django.contrib.localflavor.pl``)
==========================================
@@ -459,7 +451,7 @@ PLNationalBusinessRegisterField
-------------------------------
A form field that validates input as a Polish National Official Business
-Register Number (REGON_), having either seven or nine digits. The checksum
+Register Number (REGON_), having either seven or nine digits. The checksum
algorithm used for REGONs is documented at
http://wipos.p.lodz.pl/zylla/ut/nip-rego.html.
@@ -468,14 +460,14 @@ http://wipos.p.lodz.pl/zylla/ut/nip-rego.html.
PLPostalCodeField
-----------------
-A form field that validates input as a Polish postal code. The valid format
+A form field that validates input as a Polish postal code. The valid format
is XX-XXX, where X is a digit.
PLTaxNumberField
----------------
-A form field that validates input as a Polish Tax Number (NIP). Valid
-formats are XXX-XXX-XX-XX or XX-XX-XXX-XXX. The checksum algorithm used
+A form field that validates input as a Polish Tax Number (NIP). Valid
+formats are XXX-XXX-XX-XX or XX-XX-XXX-XXX. The checksum algorithm used
for NIPs is documented at http://wipos.p.lodz.pl/zylla/ut/nip-rego.html.
PLAdministrativeUnitSelect
@@ -490,14 +482,13 @@ PLVoivodeshipSelect
A ``Select`` widget that uses a list of Polish voivodeships (administrative
provinces) as its choices.
-
Slovakia (``django.contrib.localflavor.sk``)
============================================
SKPostalCodeField
-----------------
-A form field that validates input as a Slovak postal code. Valid formats
+A form field that validates input as a Slovak postal code. Valid formats
are XXXXX or XXX XX, where X is a digit.
SKDistrictSelect
@@ -510,24 +501,22 @@ SKRegionSelect
A ``Select`` widget that uses a list of Slovak regions as its choices.
-
South Africa (``django.contrib.localflavor.za``)
================================================
ZAIDField
---------
-A form field that validates input as a South African ID number. Validation
+A form field that validates input as a South African ID number. Validation
uses the Luhn checksum and a simplistic (i.e., not entirely accurate) check
for birth date.
ZAPostCodeField
---------------
-A form field that validates input as a South African postcode. Valid
+A form field that validates input as a South African postcode. Valid
postcodes must have four digits.
-
Spain (``django.contrib.localflavor.es``)
=========================================
@@ -541,23 +530,23 @@ ESCCCField
----------
A form field that validates input as a Spanish bank account number (Codigo
-Cuenta Cliente or CCC). A valid CCC number has the format
+Cuenta Cliente or CCC). A valid CCC number has the format
EEEE-OOOO-CC-AAAAAAAAAA, where the E, O, C and A digits denote the entity,
-office, checksum and account, respectively. The first checksum digit
-validates the entity and office. The second checksum digit validates the
-account. It is also valid to use a space as a delimiter, or to use no
+office, checksum and account, respectively. The first checksum digit
+validates the entity and office. The second checksum digit validates the
+account. It is also valid to use a space as a delimiter, or to use no
delimiter.
ESPhoneNumberField
------------------
-A form field that validates input as a Spanish phone number. Valid numbers
+A form field that validates input as a Spanish phone number. Valid numbers
have nine digits, the first of which is 6, 8 or 9.
ESPostalCodeField
-----------------
-A form field that validates input as a Spanish postal code. Valid codes
+A form field that validates input as a Spanish postal code. Valid codes
have five digits, the first two being in the range 01 to 52, representing
the province.
@@ -571,7 +560,6 @@ ESRegionSelect
A ``Select`` widget that uses a list of Spanish regions as its choices.
-
Switzerland (``django.contrib.localflavor.ch``)
===============================================
@@ -585,14 +573,14 @@ have the correct checksums -- see http://adi.kousz.ch/artikel/IDCHE.htm.
CHPhoneNumberField
------------------
-A form field that validates input as a Swiss phone number. The correct
-format is 0XX XXX XX XX. 0XX.XXX.XX.XX and 0XXXXXXXXX validate but are
+A form field that validates input as a Swiss phone number. The correct
+format is 0XX XXX XX XX. 0XX.XXX.XX.XX and 0XXXXXXXXX validate but are
corrected to 0XX XXX XX XX.
CHZipCodeField
--------------
-A form field that validates input as a Swiss zip code. Valid codes
+A form field that validates input as a Swiss zip code. Valid codes
consist of four digits.
CHStateSelect
@@ -600,7 +588,6 @@ CHStateSelect
A ``Select`` widget that uses a list of Swiss states as its choices.
-
United Kingdom (``django.contrib.localflavor.uk``)
==================================================
@@ -611,6 +598,15 @@ A form field that validates input as a UK postcode. The regular
expression used is sourced from the schema for British Standard BS7666
address types at http://www.govtalk.gov.uk/gdsc/schemas/bs7666-v2-0.xsd.
+UKCountySelect
+--------------
+
+A ``Select`` widget that uses a list of UK counties/regions as its choices.
+
+UKNationSelect
+--------------
+
+A ``Select`` widget that uses a list of UK nations as its choices.
United States of America (``django.contrib.localflavor.us``)
============================================================
@@ -626,13 +622,13 @@ USSocialSecurityNumberField
A form field that validates input as a U.S. Social Security Number (SSN).
A valid SSN must obey the following rules:
-* Format of XXX-XX-XXXX
-* No group of digits consisting entirely of zeroes
-* Leading group of digits cannot be 666
-* Number not in promotional block 987-65-4320 through 987-65-4329
-* Number not one known to be invalid due to widespread promotional
- use or distribution (e.g., the Woolworth's number or the 1962
- promotional number)
+ * Format of XXX-XX-XXXX
+ * No group of digits consisting entirely of zeroes
+ * Leading group of digits cannot be 666
+ * Number not in promotional block 987-65-4320 through 987-65-4329
+ * Number not one known to be invalid due to widespread promotional
+ use or distribution (e.g., the Woolworth's number or the 1962
+ promotional number)
USStateField
------------
@@ -644,11 +640,11 @@ for the given state.
USZipCodeField
--------------
-A form field that validates input as a U.S. zip code. Valid formats are
+A form field that validates input as a U.S. ZIP code. Valid formats are
XXXXX or XXXXX-XXXX.
USStateSelect
-------------
-A form Select widget that uses a list of U.S. states/territories as its
+A form ``Select`` widget that uses a list of U.S. states/territories as its
choices.
diff --git a/docs/middleware.txt b/docs/middleware.txt
index 39019caf1e..a2853e2965 100644
--- a/docs/middleware.txt
+++ b/docs/middleware.txt
@@ -61,17 +61,18 @@ Adds a few conveniences for perfectionists:
settings.
If ``APPEND_SLASH`` is ``True`` and the initial URL doesn't end with a slash,
- and it is not found in urlpatterns, a new URL is formed by appending a slash
- at the end. If this new URL is found in urlpatterns, then an HTTP-redirect is
- returned to this new URL; otherwise the initial URL is processed as usual.
+ and it is not found in the URLconf, then a new URL is formed by appending a
+ slash at the end. If this new URL is found in the URLconf, then Django
+ redirects the request to this new URL. Otherwise, the initial URL is
+ processed as usual.
- So ``foo.com/bar`` will be redirected to ``foo.com/bar/`` if you do not
- have a valid urlpattern for ``foo.com/bar``, and do have a valid urlpattern
- for ``foo.com/bar/``.
+ For example, ``foo.com/bar`` will be redirected to ``foo.com/bar/`` if you
+ don't have a valid URL pattern for ``foo.com/bar`` but *do* have a valid
+ pattern for ``foo.com/bar/``.
**New in Django development version:** The behavior of ``APPEND_SLASH`` has
- changed slightly in the development version. It didn't used to check to see
- whether the pattern was matched in the URLconf.
+ changed slightly in the development version. It didn't used to check whether
+ the pattern was matched in the URLconf.
If ``PREPEND_WWW`` is ``True``, URLs that lack a leading "www." will be
redirected to the same URL with a leading "www."
@@ -153,6 +154,17 @@ every incoming ``HttpRequest`` object. See `Authentication in Web requests`_.
.. _Authentication in Web requests: ../authentication/#authentication-in-web-requests
+django.contrib.csrf.middleware.CsrfMiddleware
+---------------------------------------------
+
+**New in Django development version**
+
+Adds protection against Cross Site Request Forgeries by adding hidden form
+fields to POST forms and checking requests for the correct value. See the
+`Cross Site Request Forgery protection documentation`_.
+
+.. _`Cross Site Request Forgery protection documentation`: ../csrf/
+
django.middleware.transaction.TransactionMiddleware
---------------------------------------------------
diff --git a/docs/modelforms.txt b/docs/modelforms.txt
index 372abf9811..0136540bed 100644
--- a/docs/modelforms.txt
+++ b/docs/modelforms.txt
@@ -277,7 +277,7 @@ model fields:
any attempt to ``save()`` a ``ModelForm`` with missing fields will fail.
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 anyextra required fields::
+ manually set any extra required fields::
instance = Instance(required_field='value')
form = InstanceForm(request.POST, instance=instance)
@@ -296,7 +296,7 @@ Overriding the default field types
----------------------------------
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
+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
for a given model field. You do this by declaratively specifying fields like
diff --git a/docs/request_response.txt b/docs/request_response.txt
index 2445b3e6b9..e3d794c9ba 100644
--- a/docs/request_response.txt
+++ b/docs/request_response.txt
@@ -156,6 +156,18 @@ Methods
Returns ``True`` or ``False``, designating whether ``request.GET`` or
``request.POST`` has the given key.
+``get_host()``
+ **New in Django development version**
+
+ Returns the originating host of the request using information from the
+ ``HTTP_X_FORWARDED_HOST`` and ``HTTP_HOST`` headers (in that order). If
+ they don't provide a value, the method uses a combination of
+ ``SERVER_NAME`` and ``SERVER_PORT`` as detailed in `PEP 333`_.
+
+ .. _PEP 333: http://www.python.org/dev/peps/pep-0333/
+
+ Example: ``"127.0.0.1:8000"``
+
``get_full_path()``
Returns the ``path``, plus an appended query string, if applicable.
@@ -452,7 +464,7 @@ types of HTTP responses. Like ``HttpResponse``, these subclasses live in
``HttpResponseNotModified``
The constructor doesn't take any arguments. Use this to designate that a
- page hasn't been modified since the user's last request.
+ page hasn't been modified since the user's last request (status code 304).
``HttpResponseBadRequest``
**New in Django development version.**
diff --git a/docs/sessions.txt b/docs/sessions.txt
index eddc3f174a..6355524d2e 100644
--- a/docs/sessions.txt
+++ b/docs/sessions.txt
@@ -99,7 +99,7 @@ It implements the following standard dictionary methods:
* ``items()``
- * ``setdefault()``
+ * ``setdefault()`` (**New in Django development version**)
It also has these three methods:
diff --git a/docs/settings.txt b/docs/settings.txt
index bc73f3e759..8478e0ce96 100644
--- a/docs/settings.txt
+++ b/docs/settings.txt
@@ -981,8 +981,13 @@ TEST_DATABASE_NAME
Default: ``None``
-The name of database to use when running the test suite. If a value of
-``None`` is specified, the test database will use the name ``'test_' + settings.DATABASE_NAME``. See `Testing Django Applications`_.
+The name of database to use when running the test suite.
+
+If the default value (``None``) is used with the SQLite database engine, the
+tests will use a memory resident database. For all other database engines the
+test database will use the name ``'test_' + settings.DATABASE_NAME``.
+
+See `Testing Django Applications`_.
.. _Testing Django Applications: ../testing/
diff --git a/docs/sites.txt b/docs/sites.txt
index 5896afcf41..9516b43995 100644
--- a/docs/sites.txt
+++ b/docs/sites.txt
@@ -97,7 +97,7 @@ Hooking into the current site from views
----------------------------------------
On a lower level, you can use the sites framework in your Django views to do
-particular things based on what site in which the view is being called.
+particular things based on the site in which the view is being called.
For example::
from django.conf import settings
@@ -330,13 +330,13 @@ Here's how Django uses the sites framework:
retrieving flatpages to display.
* In the `syndication framework`_, the templates for ``title`` and
- ``description`` automatically have access to a variable ``{{{ site }}}``,
+ ``description`` automatically have access to a variable ``{{ site }}``,
which is the ``Site`` object representing the current site. Also, the
hook for providing item URLs will use the ``domain`` from the current
``Site`` object if you don't specify a fully-qualified domain.
* In the `authentication framework`_, the ``django.contrib.auth.views.login``
- view passes the current ``Site`` name to the template as ``{{{ site_name }}}``.
+ view passes the current ``Site`` name to the template as ``{{ site_name }}``.
* The shortcut view (``django.views.defaults.shortcut``) uses the domain of
the current ``Site`` object when calculating an object's URL.
diff --git a/docs/syndication_feeds.txt b/docs/syndication_feeds.txt
index b3edf4c008..ebd6af26f8 100644
--- a/docs/syndication_feeds.txt
+++ b/docs/syndication_feeds.txt
@@ -201,7 +201,7 @@ the feed.
An example makes this clear. Here's the code for these beat-specific feeds::
- from django.contrib.syndication import FeedDoesNotExist
+ from django.contrib.syndication.feeds import FeedDoesNotExist
class BeatFeed(Feed):
def get_object(self, bits):
diff --git a/docs/templates_python.txt b/docs/templates_python.txt
index 4865f65331..014a853a41 100644
--- a/docs/templates_python.txt
+++ b/docs/templates_python.txt
@@ -691,8 +691,8 @@ This way, you'll be able to pass, say, an integer to this filter, and it
won't cause an ``AttributeError`` (because integers don't have ``lower()``
methods).
-Registering a custom filters
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Registering custom filters
+~~~~~~~~~~~~~~~~~~~~~~~~~~
Once you've written your filter definition, you need to register it with
your ``Library`` instance, to make it available to Django's template language::
diff --git a/docs/testing.txt b/docs/testing.txt
index 7705380eff..54b8ba9ae6 100644
--- a/docs/testing.txt
+++ b/docs/testing.txt
@@ -270,27 +270,21 @@ a test case, add the name of the test method to the label::
$ ./manage.py test animals.AnimalTestCase.testFluffyAnimals
-Understanding the test output
------------------------------
-
-When you run your tests, you'll see a number of messages as the test runner
-prepares itself::
+The test database
+-----------------
- Creating test database...
- Creating table myapp_animal
- Creating table myapp_mineral
- Loading 'initial_data' fixtures...
- No fixtures found.
+Tests that require a database (namely, model tests) will not use
+your "real" (production) database. A separate, blank database is created
+for the tests.
-This tells you that the test runner is creating a test database -- a blank,
-from-scratch database that it will use for any tests that happen to require a
-database (namely, model tests).
+Regardless of whether the tests pass or fail, the test database is destroyed
+when all the tests have been executed.
-Don't worry -- the test runner will not touch your "real" (production)
-database. It creates a separate database purely for the tests. This test
-database gets its name by prepending ``test_`` to the value of the
-``DATABASE_NAME`` setting. If you want to use a different name, specify the
-``TEST_DATABASE_NAME`` setting.
+By default this test database gets its name by prepending ``test_`` to the
+value of the ``DATABASE_NAME`` setting. When using the SQLite database engine
+the tests will by default use an in-memory database (i.e., the database will be
+created in memory, bypassing the filesystem entirely!). If you want to use a
+different database name, specify the ``TEST_DATABASE_NAME`` setting.
Aside from using a separate database, the test runner will otherwise use all of
the same database settings you have in your settings file: ``DATABASE_ENGINE``,
@@ -306,6 +300,22 @@ settings_ documentation for details of these advanced settings.
.. _settings: ../settings/
+Understanding the test output
+-----------------------------
+
+When you run your tests, you'll see a number of messages as the test runner
+prepares itself. You can control the level of detail of these messages with the
+``verbosity`` option on the command line::
+
+ Creating test database...
+ Creating table myapp_animal
+ Creating table myapp_mineral
+ Loading 'initial_data' fixtures...
+ No fixtures found.
+
+This tells you that the test runner is creating a test database, as described
+in the previous section.
+
Once the test database has been created, Django will run your tests.
If everything goes well, you'll see something like this::
@@ -349,9 +359,6 @@ failed and erroneous tests. If all the tests pass, the return code is 0. This
feature is useful if you're using the test-runner script in a shell script and
need to test for success or failure at that level.
-Regardless of whether the tests pass or fail, the test database is destroyed when
-all the tests have been executed.
-
Testing tools
=============