-
diff --git a/docs/howto/custom-template-tags.txt b/docs/howto/custom-template-tags.txt
index 5b27af8..70b6288 100644
a
|
b
|
A few things to note about the ``simple_tag`` helper function:
|
760 | 760 | * If the argument was a template variable, our function is passed the |
761 | 761 | current value of the variable, not the variable itself. |
762 | 762 | |
763 | | .. versionadded:: 1.3 |
764 | | |
765 | 763 | If your template tag needs to access the current context, you can use the |
766 | 764 | ``takes_context`` argument when registering your tag: |
767 | 765 | |
-
diff --git a/docs/howto/error-reporting.txt b/docs/howto/error-reporting.txt
index 64af2a0..78e797b 100644
a
|
b
|
setting.
|
44 | 44 | |
45 | 45 | .. seealso:: |
46 | 46 | |
47 | | .. versionadded:: 1.3 |
48 | | |
49 | 47 | Server error emails are sent using the logging framework, so you can |
50 | 48 | customize this behavior by :doc:`customizing your logging configuration |
51 | 49 | </topics/logging>`. |
… |
… |
The best way to disable this behavior is to set
|
99 | 97 | |
100 | 98 | .. seealso:: |
101 | 99 | |
102 | | .. versionadded:: 1.3 |
103 | | |
104 | 100 | 404 errors are logged using the logging framework. By default, these log |
105 | 101 | records are ignored, but you can use them for error reporting by writing a |
106 | 102 | handler and :doc:`configuring logging </topics/logging>` appropriately. |
-
diff --git a/docs/howto/static-files.txt b/docs/howto/static-files.txt
index f8c5918..964b5fa 100644
a
|
b
|
|
2 | 2 | Managing static files |
3 | 3 | ===================== |
4 | 4 | |
5 | | .. versionadded:: 1.3 |
6 | | |
7 | 5 | Django developers mostly concern themselves with the dynamic parts of web |
8 | 6 | applications -- the views and templates that render anew for each request. But |
9 | 7 | web applications have other parts: the static files (images, CSS, |
-
diff --git a/docs/misc/api-stability.txt b/docs/misc/api-stability.txt
index 2839ee3..4f232e7 100644
a
|
b
|
Certain APIs are explicitly marked as "internal" in a couple of ways:
|
155 | 155 | Local flavors |
156 | 156 | ------------- |
157 | 157 | |
158 | | .. versionchanged:: 1.3 |
159 | | |
160 | 158 | :mod:`django.contrib.localflavor` contains assorted pieces of code |
161 | 159 | that are useful for particular countries or cultures. This data is |
162 | 160 | local in nature, and is subject to change on timelines that will |
-
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 66a5a2c..2aabc55 100644
a
|
b
|
subclass::
|
129 | 129 | |
130 | 130 | date_hierarchy = 'pub_date' |
131 | 131 | |
132 | | .. versionadded:: 1.3 |
133 | | |
134 | 132 | This will intelligently populate itself based on available data, |
135 | 133 | e.g. if all the dates are in one month, it'll show the day-level |
136 | 134 | drill-down only. |
… |
… |
subclass::
|
576 | 574 | class PersonAdmin(ModelAdmin): |
577 | 575 | list_filter = ('is_staff', 'company') |
578 | 576 | |
579 | | .. versionadded:: 1.3 |
580 | | |
581 | 577 | Field names in ``list_filter`` can also span relations |
582 | 578 | using the ``__`` lookup, for example:: |
583 | 579 | |
… |
… |
subclass::
|
748 | 744 | |
749 | 745 | .. attribute:: ModelAdmin.paginator |
750 | 746 | |
751 | | .. versionadded:: 1.3 |
752 | | |
753 | 747 | The paginator class to be used for pagination. By default, |
754 | 748 | :class:`django.core.paginator.Paginator` is used. If the custom paginator |
755 | 749 | class doesn't have the same constructor interface as |
… |
… |
templates used by the :class:`ModelAdmin` views:
|
966 | 960 | |
967 | 961 | .. method:: ModelAdmin.delete_model(self, request, obj) |
968 | 962 | |
969 | | .. versionadded:: 1.3 |
970 | | |
971 | 963 | The ``delete_model`` method is given the ``HttpRequest`` and a model |
972 | 964 | instance. Use this method to do pre- or post-delete operations. |
973 | 965 | |
… |
… |
templates used by the :class:`ModelAdmin` views:
|
1213 | 1205 | |
1214 | 1206 | .. method:: ModelAdmin.get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True) |
1215 | 1207 | |
1216 | | .. versionadded:: 1.3 |
1217 | | |
1218 | 1208 | Returns an instance of the paginator to use for this view. By default, |
1219 | 1209 | instantiates an instance of :attr:`paginator`. |
1220 | 1210 | |
… |
… |
on your ``ModelAdmin``::
|
1295 | 1285 | } |
1296 | 1286 | js = ("my_code.js",) |
1297 | 1287 | |
1298 | | .. versionchanged:: 1.3 |
1299 | | |
1300 | 1288 | The :doc:`staticfiles app </ref/contrib/staticfiles>` prepends |
1301 | 1289 | :setting:`STATIC_URL` (or :setting:`MEDIA_URL` if :setting:`STATIC_URL` is |
1302 | 1290 | ``None``) to any media paths. The same rules apply as :ref:`regular media |
… |
… |
adds some of its own (the shared features are actually defined in the
|
1394 | 1382 | - :attr:`~ModelAdmin.exclude` |
1395 | 1383 | - :attr:`~ModelAdmin.filter_horizontal` |
1396 | 1384 | - :attr:`~ModelAdmin.filter_vertical` |
| 1385 | - :attr:`~ModelAdmin.ordering` |
1397 | 1386 | - :attr:`~ModelAdmin.prepopulated_fields` |
| 1387 | - :meth:`~ModelAdmin.queryset` |
1398 | 1388 | - :attr:`~ModelAdmin.radio_fields` |
1399 | 1389 | - :attr:`~ModelAdmin.readonly_fields` |
1400 | 1390 | - :attr:`~InlineModelAdmin.raw_id_fields` |
1401 | 1391 | - :meth:`~ModelAdmin.formfield_for_foreignkey` |
1402 | 1392 | - :meth:`~ModelAdmin.formfield_for_manytomany` |
1403 | 1393 | |
1404 | | .. versionadded:: 1.3 |
1405 | | |
1406 | | - :attr:`~ModelAdmin.ordering` |
1407 | | - :meth:`~ModelAdmin.queryset` |
1408 | | |
1409 | 1394 | .. versionadded:: 1.4 |
1410 | 1395 | |
1411 | 1396 | - :meth:`~ModelAdmin.has_add_permission` |
… |
… |
Templates can override or extend base admin templates as described in
|
1813 | 1798 | |
1814 | 1799 | .. attribute:: AdminSite.login_form |
1815 | 1800 | |
1816 | | .. versionadded:: 1.3 |
1817 | | |
1818 | 1801 | Subclass of :class:`~django.contrib.auth.forms.AuthenticationForm` that |
1819 | 1802 | will be used by the admin site login view. |
1820 | 1803 | |
-
diff --git a/docs/ref/contrib/comments/example.txt b/docs/ref/contrib/comments/example.txt
index e78d83c..2bff778 100644
a
|
b
|
enable it in your project's ``urls.py``:
|
152 | 152 | |
153 | 153 | Now you should have the latest comment feeds being served off ``/feeds/latest/``. |
154 | 154 | |
155 | | .. versionchanged:: 1.3 |
156 | | |
157 | | Prior to Django 1.3, the LatestCommentFeed was deployed using the |
158 | | syndication feed view: |
159 | | |
160 | | .. code-block:: python |
161 | | |
162 | | from django.conf.urls import patterns |
163 | | from django.contrib.comments.feeds import LatestCommentFeed |
164 | | |
165 | | feeds = { |
166 | | 'latest': LatestCommentFeed, |
167 | | } |
168 | | |
169 | | urlpatterns = patterns('', |
170 | | # ... |
171 | | (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', |
172 | | {'feed_dict': feeds}), |
173 | | # ... |
174 | | ) |
175 | | |
176 | 155 | |
177 | 156 | Moderation |
178 | 157 | ========== |
-
diff --git a/docs/ref/contrib/comments/moderation.txt b/docs/ref/contrib/comments/moderation.txt
index f03c7fd..39b3ea7 100644
a
|
b
|
Simply subclassing :class:`CommentModerator` and changing the values of these
|
136 | 136 | options will automatically enable the various moderation methods for any |
137 | 137 | models registered using the subclass. |
138 | 138 | |
139 | | .. versionchanged:: 1.3 |
140 | | |
141 | | ``moderate_after`` and ``close_after`` now accept 0 as a valid value. |
142 | | |
143 | 139 | Adding custom moderation methods |
144 | 140 | -------------------------------- |
145 | 141 | |
-
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt
index 0226435..aba6ebb 100644
a
|
b
|
pointing at it will be deleted as well. In the example above, this means that
|
415 | 415 | if a ``Bookmark`` object were deleted, any ``TaggedItem`` objects pointing at |
416 | 416 | it would be deleted at the same time. |
417 | 417 | |
418 | | .. versionadded:: 1.3 |
419 | | |
420 | 418 | Unlike :class:`~django.db.models.ForeignKey`, |
421 | 419 | :class:`~django.contrib.contenttypes.generic.GenericForeignKey` does not accept |
422 | 420 | an :attr:`~django.db.models.ForeignKey.on_delete` argument to customize this |
-
diff --git a/docs/ref/contrib/flatpages.txt b/docs/ref/contrib/flatpages.txt
index 3de4497..38cedc4 100644
a
|
b
|
template.
|
239 | 239 | Getting a list of :class:`~django.contrib.flatpages.models.FlatPage` objects in your templates |
240 | 240 | ============================================================================================== |
241 | 241 | |
242 | | .. versionadded:: 1.3 |
243 | | |
244 | 242 | The flatpages app provides a template tag that allows you to iterate |
245 | 243 | over all of the available flatpages on the :ref:`current site |
246 | 244 | <hooking-into-current-site-from-views>`. |
-
diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt
index f4e706d..b8fb7b4 100644
a
|
b
|
Returns a boolean indicating whether the geometry is valid.
|
232 | 232 | |
233 | 233 | .. attribute:: GEOSGeometry.valid_reason |
234 | 234 | |
235 | | .. versionadded:: 1.3 |
236 | | |
237 | 235 | Returns a string describing the reason why a geometry is invalid. |
238 | 236 | |
239 | 237 | .. attribute:: GEOSGeometry.srid |
… |
… |
corresponding to the SRID of the geometry or ``None``.
|
530 | 528 | |
531 | 529 | .. method:: GEOSGeometry.transform(ct, clone=False) |
532 | 530 | |
533 | | .. versionchanged:: 1.3 |
534 | | |
535 | 531 | Transforms the geometry according to the given coordinate transformation paramter |
536 | 532 | (``ct``), which may be an integer SRID, spatial reference WKT string, |
537 | 533 | a PROJ.4 string, a :class:`~django.contrib.gis.gdal.SpatialReference` object, or a |
-
diff --git a/docs/ref/contrib/gis/testing.txt b/docs/ref/contrib/gis/testing.txt
index d12c884..86979f0 100644
a
|
b
|
your settings::
|
134 | 134 | GeoDjango tests |
135 | 135 | =============== |
136 | 136 | |
137 | | .. versionchanged:: 1.3 |
138 | | |
139 | 137 | GeoDjango's test suite may be run in one of two ways, either by itself or |
140 | 138 | with the rest of :ref:`Django's unit tests <running-unit-tests>`. |
141 | 139 | |
-
diff --git a/docs/ref/contrib/localflavor.txt b/docs/ref/contrib/localflavor.txt
index 4595f51..0d1319e 100644
a
|
b
|
Austria (``at``)
|
267 | 267 | Belgium (``be``) |
268 | 268 | ================ |
269 | 269 | |
270 | | .. versionadded:: 1.3 |
271 | | |
272 | 270 | .. class:: be.forms.BEPhoneNumberField |
273 | 271 | |
274 | 272 | A form field that validates input as a Belgium phone number, with one of |
… |
… |
Indonesia (``id``)
|
658 | 656 | |
659 | 657 | A ``Select`` widget that uses a list of Indonesian provinces as its choices. |
660 | 658 | |
661 | | .. versionchanged:: 1.3 |
662 | | The province "Nanggroe Aceh Darussalam (NAD)" has been removed |
663 | | from the province list in favor of the new official designation |
664 | | "Aceh (ACE)". |
665 | | |
666 | 659 | .. class:: id.forms.IDPhoneNumberField |
667 | 660 | |
668 | 661 | A form field that validates input as an Indonesian telephone number. |
-
diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt
index 2393a4a..ef6c64d 100644
a
|
b
|
with a caching decorator -- you must name your sitemap view and pass
|
330 | 330 | Template customization |
331 | 331 | ====================== |
332 | 332 | |
333 | | .. versionadded:: 1.3 |
334 | | |
335 | 333 | If you wish to use a different template for each sitemap or sitemap index |
336 | 334 | available on your site, you may specify it by passing a ``template_name`` |
337 | 335 | parameter to the ``sitemap`` and ``index`` views via the URLconf:: |
-
diff --git a/docs/ref/contrib/sites.txt b/docs/ref/contrib/sites.txt
index 8fc434b..8bb7b27 100644
a
|
b
|
the :class:`~django.contrib.sites.models.Site` model's manager has a
|
159 | 159 | else: |
160 | 160 | # Do something else. |
161 | 161 | |
162 | | .. versionchanged:: 1.3 |
163 | | |
164 | 162 | For code which relies on getting the current domain but cannot be certain |
165 | 163 | that the sites framework will be installed for any given project, there is a |
166 | 164 | utility function :func:`~django.contrib.sites.models.get_current_site` that |
… |
… |
the sites framework is installed) or a RequestSite instance (if it is not).
|
169 | 167 | This allows loose coupling with the sites framework and provides a usable |
170 | 168 | fallback for cases where it is not installed. |
171 | 169 | |
172 | | .. versionadded:: 1.3 |
173 | | |
174 | 170 | .. function:: get_current_site(request) |
175 | 171 | |
176 | 172 | Checks if contrib.sites is installed and returns either the current |
177 | | :class:`~django.contrib.sites.models.Site` object or a |
| 173 | :class:`~django.contrib.sites.models.Site` object or a |
178 | 174 | :class:`~django.contrib.sites.models.RequestSite` object based on |
179 | 175 | the request. |
180 | 176 | |
… |
… |
fallback when the database-backed sites framework is not available.
|
437 | 433 | |
438 | 434 | Sets the ``name`` and ``domain`` attributes to the value of |
439 | 435 | :meth:`~django.http.HttpRequest.get_host`. |
440 | | |
| 436 | |
441 | 437 | |
442 | 438 | A :class:`~django.contrib.sites.models.RequestSite` object has a similar |
443 | 439 | interface to a normal :class:`~django.contrib.sites.models.Site` object, except |
-
diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt
index cbe8ad5..3a74797 100644
a
|
b
|
The staticfiles app
|
5 | 5 | .. module:: django.contrib.staticfiles |
6 | 6 | :synopsis: An app for handling static files. |
7 | 7 | |
8 | | .. versionadded:: 1.3 |
9 | | |
10 | 8 | ``django.contrib.staticfiles`` collects static files from each of your |
11 | 9 | applications (and any other places you specify) into a single location that |
12 | 10 | can easily be served in production. |
-
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 5ff7ecb..b606bd3 100644
a
|
b
|
records to dump. If you're using a :ref:`custom manager <custom-managers>` as
|
176 | 176 | the default manager and it filters some of the available records, not all of the |
177 | 177 | objects will be dumped. |
178 | 178 | |
179 | | .. versionadded:: 1.3 |
180 | | |
181 | 179 | The :djadminopt:`--all` option may be provided to specify that |
182 | 180 | ``dumpdata`` should use Django's base manager, dumping records which |
183 | 181 | might otherwise be filtered or modified by a custom manager. |
… |
… |
pretty-print the output with a number of indentation spaces.
|
197 | 195 | The :djadminopt:`--exclude` option may be provided to prevent specific |
198 | 196 | applications from being dumped. |
199 | 197 | |
200 | | .. versionadded:: 1.3 |
201 | | |
202 | 198 | The :djadminopt:`--exclude` option may also be provided to prevent specific |
203 | 199 | models (specified as in the form of ``appname.ModelName``) from being dumped. |
204 | 200 | |
… |
… |
Use the ``--no-default-ignore`` option to disable the default values of
|
463 | 459 | |
464 | 460 | .. django-admin-option:: --no-wrap |
465 | 461 | |
466 | | .. versionadded:: 1.3 |
467 | | |
468 | 462 | Use the ``--no-wrap`` option to disable breaking long message lines into |
469 | 463 | several lines in language files. |
470 | 464 | |
… |
… |
machines on your network. To make your development server viewable to other
|
640 | 634 | machines on the network, use its own IP address (e.g. ``192.168.2.1``) or |
641 | 635 | ``0.0.0.0`` or ``::`` (with IPv6 enabled). |
642 | 636 | |
643 | | .. versionchanged:: 1.3 |
644 | | |
645 | 637 | You can provide an IPv6 address surrounded by brackets |
646 | 638 | (e.g. ``[200a::1]:8000``). This will automatically enable IPv6 support. |
647 | 639 | |
648 | 640 | A hostname containing ASCII-only characters can also be used. |
649 | 641 | |
650 | | .. versionchanged:: 1.3 |
651 | | |
652 | 642 | If the :doc:`staticfiles</ref/contrib/staticfiles>` contrib app is enabled |
653 | 643 | (default in new projects) the :djadmin:`runserver` command will be overriden |
654 | 644 | with an own :djadmin:`runserver<staticfiles-runserver>` command. |
… |
… |
development server.
|
674 | 664 | |
675 | 665 | .. django-admin-option:: --ipv6, -6 |
676 | 666 | |
677 | | .. versionadded:: 1.3 |
678 | | |
679 | 667 | Use the ``--ipv6`` (or shorter ``-6``) option to tell Django to use IPv6 for |
680 | 668 | the development server. This changes the default IP address from |
681 | 669 | ``127.0.0.1`` to ``::1``. |
… |
… |
To run on 1.2.3.4:7000 with a ``test`` fixture::
|
1113 | 1101 | |
1114 | 1102 | django-admin.py testserver --addrport 1.2.3.4:7000 test |
1115 | 1103 | |
1116 | | .. versionadded:: 1.3 |
1117 | | |
1118 | 1104 | The :djadminopt:`--noinput` option may be provided to suppress all user |
1119 | 1105 | prompts. |
1120 | 1106 | |
-
diff --git a/docs/ref/files/storage.txt b/docs/ref/files/storage.txt
index b3f8909..f9bcf9b 100644
a
|
b
|
Django provides two convenient ways to access the current storage class:
|
18 | 18 | .. function:: get_storage_class([import_path=None]) |
19 | 19 | |
20 | 20 | Returns a class or module which implements the storage API. |
21 | | |
| 21 | |
22 | 22 | When called without the ``import_path`` parameter ``get_storage_class`` |
23 | 23 | will return the current default storage system as defined by |
24 | 24 | :setting:`DEFAULT_FILE_STORAGE`. If ``import_path`` is provided, |
… |
… |
The FileSystemStorage Class
|
35 | 35 | basic file storage on a local filesystem. It inherits from |
36 | 36 | :class:`~django.core.files.storage.Storage` and provides implementations |
37 | 37 | for all the public methods thereof. |
38 | | |
| 38 | |
39 | 39 | .. note:: |
40 | | |
| 40 | |
41 | 41 | The :class:`FileSystemStorage.delete` method will not raise |
42 | 42 | raise an exception if the given file name does not exist. |
43 | 43 | |
… |
… |
The Storage Class
|
53 | 53 | |
54 | 54 | .. method:: accessed_time(name) |
55 | 55 | |
56 | | .. versionadded:: 1.3 |
57 | | |
58 | 56 | Returns a ``datetime`` object containing the last accessed time of the |
59 | 57 | file. For storage systems that aren't able to return the last accessed |
60 | 58 | time this will raise ``NotImplementedError`` instead. |
61 | 59 | |
62 | 60 | .. method:: created_time(name) |
63 | 61 | |
64 | | .. versionadded:: 1.3 |
65 | | |
66 | 62 | Returns a ``datetime`` object containing the creation time of the file. |
67 | 63 | For storage systems that aren't able to return the creation time this |
68 | 64 | will raise ``NotImplementedError`` instead. |
… |
… |
The Storage Class
|
100 | 96 | |
101 | 97 | .. method:: modified_time(name) |
102 | 98 | |
103 | | .. versionadded:: 1.3 |
104 | | |
105 | 99 | Returns a ``datetime`` object containing the last modified time. For |
106 | 100 | storage systems that aren't able to return the last modified time, this |
107 | 101 | will raise ``NotImplementedError`` instead. |
-
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt
index 777d73e..2323425 100644
a
|
b
|
those classes as an argument::
|
658 | 658 | |
659 | 659 | .. method:: BoundField.value() |
660 | 660 | |
661 | | .. versionadded:: 1.3 |
662 | | |
663 | 661 | Use this method to render the raw value of this field as it would be rendered |
664 | 662 | by a ``Widget``:: |
665 | 663 | |
-
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index 2a8f449..98c8a81 100644
a
|
b
|
For each field, we describe the default widget used if you don't specify
|
704 | 704 | ``TypedMultipleChoiceField`` |
705 | 705 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
706 | 706 | |
707 | | .. versionadded:: 1.3 |
708 | | |
709 | 707 | .. class:: TypedMultipleChoiceField(**kwargs) |
710 | 708 | |
711 | 709 | Just like a :class:`MultipleChoiceField`, except :class:`TypedMultipleChoiceField` |
-
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index eab314a..34be52b 100644
a
|
b
|
commonly used groups of widgets:
|
192 | 192 | Determines whether the widget will have a value filled in when the |
193 | 193 | form is re-displayed after a validation error (default is ``False``). |
194 | 194 | |
195 | | .. versionchanged:: 1.3 |
196 | | The default value for |
197 | | :attr:`~PasswordInput.render_value` was |
198 | | changed from ``True`` to ``False`` |
199 | | |
200 | 195 | ``HiddenInput`` |
201 | 196 | ~~~~~~~~~~~~~~~ |
202 | 197 | |
… |
… |
commonly used groups of widgets:
|
232 | 227 | |
233 | 228 | .. class:: ClearableFileInput |
234 | 229 | |
235 | | .. versionadded:: 1.3 |
236 | | |
237 | 230 | File upload input: ``<input type='file' ...>``, with an additional checkbox |
238 | 231 | input to clear the field's value, if the field is not required and has |
239 | 232 | initial data. |
-
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 8b3c31f..384e226 100644
a
|
b
|
define the details of how the relation works.
|
1023 | 1023 | The field on the related object that the relation is to. By default, Django |
1024 | 1024 | uses the primary key of the related object. |
1025 | 1025 | |
1026 | | .. versionadded:: 1.3 |
1027 | | |
1028 | 1026 | .. attribute:: ForeignKey.on_delete |
1029 | 1027 | |
1030 | 1028 | When an object referenced by a :class:`ForeignKey` is deleted, Django by |
-
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index 80b3158..39c9f01 100644
a
|
b
|
followed (optionally) by any output-affecting methods (such as ``values()``),
|
505 | 505 | but it doesn't really matter. This is your chance to really flaunt your |
506 | 506 | individualism. |
507 | 507 | |
508 | | .. versionchanged:: 1.3 |
509 | | |
510 | | The ``values()`` method previously did not return anything for |
511 | | :class:`~django.db.models.ManyToManyField` attributes and would raise an error |
512 | | if you tried to pass this type of field to it. |
513 | | |
514 | | This restriction has been lifted, and you can now also refer to fields on |
515 | | related models with reverse relations through ``OneToOneField``, ``ForeignKey`` |
516 | | and ``ManyToManyField`` attributes:: |
| 508 | You can also refer to fields on related models with reverse relations through |
| 509 | ``OneToOneField``, ``ForeignKey`` and ``ManyToManyField`` attributes:: |
517 | 510 | |
518 | 511 | Blog.objects.values('name', 'entry__headline') |
519 | 512 | [{'name': 'My blog', 'entry__headline': 'An entry'}, |
… |
… |
For example::
|
1664 | 1657 | # This will delete all Blogs and all of their Entry objects. |
1665 | 1658 | blogs.delete() |
1666 | 1659 | |
1667 | | .. versionadded:: 1.3 |
1668 | | This cascade behavior is customizable via the |
1669 | | :attr:`~django.db.models.ForeignKey.on_delete` argument to the |
1670 | | :class:`~django.db.models.ForeignKey`. |
| 1660 | This cascade behavior is customizable via the |
| 1661 | :attr:`~django.db.models.ForeignKey.on_delete` argument to the |
| 1662 | :class:`~django.db.models.ForeignKey`. |
1671 | 1663 | |
1672 | 1664 | The ``delete()`` method does a bulk delete and does not call any ``delete()`` |
1673 | 1665 | methods on your models. It does, however, emit the |
-
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 21e99de..cc2a351 100644
a
|
b
|
All attributes should be considered read-only, unless stated otherwise below.
|
42 | 42 | data in different ways than conventional HTML forms: binary images, |
43 | 43 | XML payload etc. For processing conventional form data, use ``HttpRequest.POST``. |
44 | 44 | |
45 | | .. versionadded:: 1.3 |
46 | | |
47 | 45 | You can also read from an HttpRequest using a file-like interface. See |
48 | 46 | :meth:`HttpRequest.read()`. |
49 | 47 | |
… |
… |
Methods
|
305 | 303 | .. method:: HttpRequest.xreadlines() |
306 | 304 | .. method:: HttpRequest.__iter__() |
307 | 305 | |
308 | | .. versionadded:: 1.3 |
309 | | |
310 | 306 | Methods implementing a file-like interface for reading from an |
311 | 307 | HttpRequest instance. This makes it possible to consume an incoming |
312 | 308 | request in a streaming fashion. A common use-case would be to process a |
… |
… |
In addition, ``QueryDict`` has the following methods:
|
509 | 505 | >>> q.urlencode() |
510 | 506 | 'a=2&b=3&b=5' |
511 | 507 | |
512 | | .. versionchanged:: 1.3 |
513 | | The ``safe`` parameter was added. |
514 | | |
515 | 508 | Optionally, urlencode can be passed characters which |
516 | 509 | do not require encoding. For example:: |
517 | 510 | |
… |
… |
Methods
|
648 | 641 | |
649 | 642 | .. method:: HttpResponse.set_cookie(key, value='', max_age=None, expires=None, path='/', domain=None, secure=None, httponly=True) |
650 | 643 | |
651 | | .. versionchanged:: 1.3 |
652 | | |
653 | | The possibility of specifying a ``datetime.datetime`` object in |
654 | | ``expires``, and the auto-calculation of ``max_age`` in such case |
655 | | was added. The ``httponly`` argument was also added. |
656 | | |
657 | 644 | .. versionchanged:: 1.4 |
658 | 645 | |
659 | 646 | The default value for httponly was changed from ``False`` to ``True``. |
-
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index f443138..ec48d08 100644
a
|
b
|
The site-specific user profile model used by this site. See
|
125 | 125 | CACHES |
126 | 126 | ------ |
127 | 127 | |
128 | | .. versionadded:: 1.3 |
129 | | |
130 | 128 | Default:: |
131 | 129 | |
132 | 130 | { |
… |
… |
Only supported for the ``mysql`` backend (see the `MySQL manual`_ for details).
|
534 | 532 | TEST_DEPENDENCIES |
535 | 533 | ~~~~~~~~~~~~~~~~~ |
536 | 534 | |
537 | | .. versionadded:: 1.3 |
538 | | |
539 | 535 | Default: ``['default']``, for all databases other than ``default``, |
540 | 536 | which has no dependencies. |
541 | 537 | |
… |
… |
the ``locale`` directory (i.e. ``'/path/to/locale'``).
|
1262 | 1258 | LOGGING |
1263 | 1259 | ------- |
1264 | 1260 | |
1265 | | .. versionadded:: 1.3 |
1266 | | |
1267 | 1261 | Default: A logging configuration dictionary. |
1268 | 1262 | |
1269 | 1263 | A data structure containing configuration information. The contents of |
… |
… |
email log handler; all other log messages are given to a NullHandler.
|
1278 | 1272 | LOGGING_CONFIG |
1279 | 1273 | -------------- |
1280 | 1274 | |
1281 | | .. versionadded:: 1.3 |
1282 | | |
1283 | 1275 | Default: ``'django.utils.log.dictConfig'`` |
1284 | 1276 | |
1285 | 1277 | A path to a callable that will be used to configure logging in the |
… |
… |
MEDIA_URL
|
1374 | 1366 | Default: ``''`` (Empty string) |
1375 | 1367 | |
1376 | 1368 | URL that handles the media served from :setting:`MEDIA_ROOT`, used |
1377 | | for :doc:`managing stored files </topics/files>`. |
| 1369 | for :doc:`managing stored files </topics/files>`. It must end in a slash if set |
| 1370 | to a non-empty value. |
1378 | 1371 | |
1379 | 1372 | Example: ``"http://media.example.com/"`` |
1380 | 1373 | |
1381 | | .. versionchanged:: 1.3 |
1382 | | It must end in a slash if set to a non-empty value. |
1383 | | |
1384 | 1374 | MESSAGE_LEVEL |
1385 | 1375 | ------------- |
1386 | 1376 | |
… |
… |
A tuple of callables that are used to populate the context in ``RequestContext``
|
1899 | 1889 | These callables take a request object as their argument and return a dictionary |
1900 | 1890 | of items to be merged into the context. |
1901 | 1891 | |
1902 | | .. versionadded:: 1.3 |
1903 | | The ``django.core.context_processors.static`` context processor |
1904 | | was added in this release. |
1905 | | |
1906 | 1892 | .. versionadded:: 1.4 |
1907 | 1893 | The ``django.core.context_processors.tz`` context processor |
1908 | 1894 | was added in this release. |
… |
… |
See also :setting:`TIME_ZONE`, :setting:`USE_I18N` and :setting:`USE_L10N`.
|
2163 | 2149 | USE_X_FORWARDED_HOST |
2164 | 2150 | -------------------- |
2165 | 2151 | |
2166 | | .. versionadded:: 1.3.1 |
2167 | | |
2168 | 2152 | Default: ``False`` |
2169 | 2153 | |
2170 | 2154 | A boolean that specifies whether to use the X-Forwarded-Host header in |
-
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt
index b2f2e85..f96ef30 100644
a
|
b
|
Arguments sent with this signal:
|
118 | 118 | records in the database as the database might not be in a |
119 | 119 | consistent state yet. |
120 | 120 | |
121 | | .. versionadded:: 1.3 |
122 | | |
123 | 121 | ``using`` |
124 | 122 | The database alias being used. |
125 | 123 | |
… |
… |
Arguments sent with this signal:
|
155 | 153 | records in the database as the database might not be in a |
156 | 154 | consistent state yet. |
157 | 155 | |
158 | | .. versionadded:: 1.3 |
159 | | |
160 | 156 | ``using`` |
161 | 157 | The database alias being used. |
162 | 158 | |
… |
… |
Arguments sent with this signal:
|
183 | 179 | ``instance`` |
184 | 180 | The actual instance being deleted. |
185 | 181 | |
186 | | .. versionadded:: 1.3 |
187 | | |
188 | 182 | ``using`` |
189 | 183 | The database alias being used. |
190 | 184 | |
… |
… |
Arguments sent with this signal:
|
209 | 203 | Note that the object will no longer be in the database, so be very |
210 | 204 | careful what you do with this instance. |
211 | 205 | |
212 | | .. versionadded:: 1.3 |
213 | | |
214 | 206 | ``using`` |
215 | 207 | The database alias being used. |
216 | 208 | |
… |
… |
Arguments sent with this signal:
|
271 | 263 | |
272 | 264 | For the ``pre_clear`` and ``post_clear`` actions, this is ``None``. |
273 | 265 | |
274 | | .. versionadded:: 1.3 |
275 | | |
276 | 266 | ``using`` |
277 | 267 | The database alias being used. |
278 | 268 | |
-
diff --git a/docs/ref/template-response.txt b/docs/ref/template-response.txt
index 9e09077..d9b7130 100644
a
|
b
|
|
2 | 2 | TemplateResponse and SimpleTemplateResponse |
3 | 3 | =========================================== |
4 | 4 | |
5 | | .. versionadded:: 1.3 |
6 | | |
7 | 5 | .. module:: django.template.response |
8 | 6 | :synopsis: Classes dealing with lazy-rendered HTTP responses. |
9 | 7 | |
-
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 48bd346..f29d2ac 100644
a
|
b
|
it. Example::
|
160 | 160 | >>> t.render(Context({"person": PersonClass2})) |
161 | 161 | "My name is Samantha." |
162 | 162 | |
163 | | .. versionchanged:: 1.3 |
164 | | Previously, only variables that originated with an attribute lookup would |
165 | | be called by the template system. This change was made for consistency |
166 | | across lookup types. |
167 | | |
168 | 163 | Callable variables are slightly more complex than variables which only require |
169 | 164 | straight lookups. Here are some things to keep in mind: |
170 | 165 | |
… |
… |
If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every
|
448 | 443 | ``django.contrib.auth.context_processors.PermWrapper``, representing the |
449 | 444 | permissions that the currently logged-in user has. |
450 | 445 | |
451 | | .. versionchanged:: 1.3 |
452 | | Prior to version 1.3, ``PermWrapper`` was located in |
453 | | ``django.contrib.auth.context_processors``. |
454 | | |
455 | | |
456 | 446 | django.core.context_processors.debug |
457 | 447 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
458 | 448 | |
… |
… |
django.core.context_processors.static
|
491 | 481 | |
492 | 482 | .. function:: django.core.context_processors.static |
493 | 483 | |
494 | | .. versionadded:: 1.3 |
495 | | |
496 | 484 | If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every |
497 | 485 | ``RequestContext`` will contain a variable ``STATIC_URL``, providing the |
498 | 486 | value of the :setting:`STATIC_URL` setting. |
-
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index 072eebf..514953d 100644
a
|
b
|
In this syntax, each value gets interpreted as a literal string, and there's no
|
156 | 156 | way to specify variable values. Or literal commas. Or spaces. Did we mention |
157 | 157 | you shouldn't use this syntax in any new projects? |
158 | 158 | |
159 | | .. versionadded:: 1.3 |
160 | | |
161 | 159 | By default, when you use the ``as`` keyword with the cycle tag, the |
162 | 160 | usage of ``{% cycle %}`` that declares the cycle will itself output |
163 | 161 | the first value in the cycle. This could be a problem if you want to |
… |
… |
including it. This example produces the output ``"Hello, John"``:
|
676 | 674 | |
677 | 675 | {{ greeting }}, {{ person|default:"friend" }}! |
678 | 676 | |
679 | | .. versionchanged:: 1.3 |
680 | | Additional context and exclusive context. |
681 | | |
682 | 677 | You can pass additional context to the template using keyword arguments:: |
683 | 678 | |
684 | 679 | {% include "name_snippet.html" with person="Jane" greeting="Hello" %} |
… |
… |
registered in ``somelibrary`` and ``otherlibrary`` located in package
|
710 | 705 | |
711 | 706 | {% load somelibrary package.otherlibrary %} |
712 | 707 | |
713 | | .. versionchanged:: 1.3 |
714 | | |
715 | 708 | You can also selectively load individual filters or tags from a library, using |
716 | 709 | the ``from`` argument. In this example, the template tags/filters named ``foo`` |
717 | 710 | and ``bar`` will be loaded from ``somelibrary``:: |
… |
… |
which is rounded up to 88).
|
1076 | 1069 | with |
1077 | 1070 | ^^^^ |
1078 | 1071 | |
1079 | | .. versionchanged:: 1.3 |
1080 | | New keyword argument format and multiple variable assignments. |
1081 | | |
1082 | 1072 | Caches a complex variable under a simpler name. This is useful when accessing |
1083 | 1073 | an "expensive" method (e.g., one that hits the database) multiple times. |
1084 | 1074 | |
… |
… |
For example::
|
2126 | 2116 | If ``value`` is ``"http://www.example.org/foo?a=b&c=d"``, the output will be |
2127 | 2117 | ``"http%3A//www.example.org/foo%3Fa%3Db%26c%3Dd"``. |
2128 | 2118 | |
2129 | | .. versionadded:: 1.3 |
2130 | | |
2131 | 2119 | An optional argument containing the characters which should not be escaped can |
2132 | 2120 | be provided. |
2133 | 2121 | |
-
diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt
index c45e4bb..c4c4bc9 100644
a
|
b
|
How to log a user out
|
830 | 830 | Login and logout signals |
831 | 831 | ------------------------ |
832 | 832 | |
833 | | .. versionadded:: 1.3 |
834 | | |
835 | 833 | The auth framework uses two :doc:`signals </topics/signals>` that can be used |
836 | 834 | for notification when a user logs in or out. |
837 | 835 | |
… |
… |
The login_required decorator
|
930 | 928 | context variable which stores the redirect path will use the value of |
931 | 929 | ``redirect_field_name`` as its key rather than ``"next"`` (the default). |
932 | 930 | |
933 | | .. versionadded:: 1.3 |
934 | | |
935 | 931 | :func:`~django.contrib.auth.decorators.login_required` also takes an |
936 | 932 | optional ``login_url`` parameter. Example:: |
937 | 933 | |
… |
… |
includes a few other useful built-in views located in
|
1159 | 1155 | that can be used to reset the password, and sending that link to the |
1160 | 1156 | user's registered email address. |
1161 | 1157 | |
1162 | | .. versionchanged:: 1.3 |
1163 | | The ``from_email`` argument was added. |
1164 | | |
1165 | 1158 | .. versionchanged:: 1.4 |
1166 | 1159 | Users flagged with an unusable password (see |
1167 | 1160 | :meth:`~django.contrib.auth.models.User.set_unusable_password()` |
… |
… |
The currently logged-in user's permissions are stored in the template variable
|
1642 | 1635 | :class:`django.contrib.auth.context_processors.PermWrapper`, which is a |
1643 | 1636 | template-friendly proxy of permissions. |
1644 | 1637 | |
1645 | | .. versionchanged:: 1.3 |
1646 | | Prior to version 1.3, ``PermWrapper`` was located in |
1647 | | ``django.core.context_processors``. |
1648 | | |
1649 | 1638 | In the ``{{ perms }}`` object, single-attribute lookup is a proxy to |
1650 | 1639 | :meth:`User.has_module_perms <django.contrib.auth.models.User.has_module_perms>`. |
1651 | 1640 | This example would display ``True`` if the logged-in user had any permissions |
… |
… |
for example, to control anonymous access.
|
1921 | 1910 | Authorization for inactive users |
1922 | 1911 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1923 | 1912 | |
1924 | | .. versionchanged:: 1.3 |
1925 | | |
1926 | 1913 | An inactive user is a one that is authenticated but has its attribute |
1927 | 1914 | ``is_active`` set to ``False``. However this does not mean they are not |
1928 | 1915 | authorized to do anything. For example they are allowed to activate their |
-
diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt
index f13238e..77d2de7 100644
a
|
b
|
Your cache preference goes in the :setting:`CACHES` setting in your
|
51 | 51 | settings file. Here's an explanation of all available values for |
52 | 52 | :setting:`CACHES`. |
53 | 53 | |
54 | | .. versionchanged:: 1.3 |
55 | | The settings used to configure caching changed in Django 1.3. In |
56 | | Django 1.2 and earlier, you used a single string-based |
57 | | :setting:`CACHE_BACKEND` setting to configure caches. This has |
58 | | been replaced with the new dictionary-based :setting:`CACHES` |
59 | | setting. |
60 | | |
61 | 54 | .. _memcached: |
62 | 55 | |
63 | 56 | Memcached |
… |
… |
two most common are `python-memcached`_ and `pylibmc`_.
|
83 | 76 | .. _`python-memcached`: ftp://ftp.tummy.com/pub/python-memcached/ |
84 | 77 | .. _`pylibmc`: http://sendapatch.se/projects/pylibmc/ |
85 | 78 | |
86 | | .. versionchanged:: 1.3 |
87 | | Support for ``pylibmc`` was added. |
88 | | |
89 | 79 | To use Memcached with Django: |
90 | 80 | |
91 | 81 | * Set :setting:`BACKEND <CACHES-BACKEND>` to |
… |
… |
nonexistent cache key.::
|
785 | 775 | Cache key prefixing |
786 | 776 | ------------------- |
787 | 777 | |
788 | | .. versionadded:: 1.3 |
789 | | |
790 | 778 | If you are sharing a cache instance between servers, or between your |
791 | 779 | production and development environments, it's possible for data cached |
792 | 780 | by one server to be used by another server. If the format of cached |
… |
… |
collisions in cache values.
|
807 | 795 | Cache versioning |
808 | 796 | ---------------- |
809 | 797 | |
810 | | .. versionadded:: 1.3 |
811 | | |
812 | 798 | When you change running code that uses cached values, you may need to |
813 | 799 | purge any existing cached values. The easiest way to do this is to |
814 | 800 | flush the entire cache, but this can lead to the loss of cache values |
… |
… |
keys unaffected. Continuing our previous example::
|
856 | 842 | Cache key transformation |
857 | 843 | ------------------------ |
858 | 844 | |
859 | | .. versionadded:: 1.3 |
860 | | |
861 | 845 | As described in the previous two sections, the cache key provided by a |
862 | 846 | user is not used verbatim -- it is combined with the cache prefix and |
863 | 847 | key version to provide a final cache key. By default, the three parts |
… |
… |
be used instead of the default key combining function.
|
878 | 862 | Cache key warnings |
879 | 863 | ------------------ |
880 | 864 | |
881 | | .. versionadded:: 1.3 |
882 | | |
883 | 865 | Memcached, the most commonly-used production cache backend, does not allow |
884 | 866 | cache keys longer than 250 characters or containing whitespace or control |
885 | 867 | characters, and using such keys will cause an exception. To encourage |
… |
… |
mechanism should take into account when building its cache key. For example, if
|
966 | 948 | the contents of a Web page depend on a user's language preference, the page is |
967 | 949 | said to "vary on language." |
968 | 950 | |
969 | | .. versionchanged:: 1.3 |
970 | | In Django 1.3 the full request path -- including the query -- is used |
971 | | to create the cache keys, instead of only the path component in Django 1.2. |
972 | | |
973 | 951 | By default, Django's cache system creates its cache keys using the requested |
974 | 952 | path and query -- e.g., ``"/stories/2005/?order_by=author"``. This means every |
975 | 953 | request to that URL will use the same cached version, regardless of user-agent |
-
diff --git a/docs/topics/class-based-views/index.txt b/docs/topics/class-based-views/index.txt
index 2d3e00a..a738221 100644
a
|
b
|
|
2 | 2 | Class-based views |
3 | 3 | ================= |
4 | 4 | |
5 | | .. versionadded:: 1.3 |
6 | | |
7 | 5 | A view is a callable which takes a request and returns a |
8 | 6 | response. This can be more than just a function, and Django provides |
9 | 7 | an example of some classes which can be used as views. These allow you |
-
diff --git a/docs/topics/class-based-views/mixins.txt b/docs/topics/class-based-views/mixins.txt
index f07769f..f349c23 100644
a
|
b
|
|
2 | 2 | Using mixins with class-based views |
3 | 3 | =================================== |
4 | 4 | |
5 | | .. versionadded:: 1.3 |
6 | | |
7 | 5 | .. caution:: |
8 | 6 | |
9 | 7 | This is an advanced topic. A working knowledge of :doc:`Django's |
-
diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt
index 5385b2a..dd16065 100644
a
|
b
|
issue the query::
|
633 | 633 | |
634 | 634 | >>> Entry.objects.filter(authors__name=F('blog__name')) |
635 | 635 | |
636 | | .. versionadded:: 1.3 |
637 | | |
638 | 636 | For date and date/time fields, you can add or subtract a |
639 | 637 | :class:`~datetime.timedelta` object. The following would return all entries |
640 | 638 | that were modified more than 3 days after they were published:: |
… |
… |
it. For example::
|
876 | 874 | # This will delete the Blog and all of its Entry objects. |
877 | 875 | b.delete() |
878 | 876 | |
879 | | .. versionadded:: 1.3 |
880 | 877 | This cascade behavior is customizable via the |
881 | 878 | :attr:`~django.db.models.ForeignKey.on_delete` argument to the |
882 | 879 | :class:`~django.db.models.ForeignKey`. |
-
diff --git a/docs/topics/db/sql.txt b/docs/topics/db/sql.txt
index 19daffd..310dcb5 100644
a
|
b
|
By default, the Python DB API will return results without their field
|
242 | 242 | names, which means you end up with a ``list`` of values, rather than a |
243 | 243 | ``dict``. At a small performance cost, you can return results as a |
244 | 244 | ``dict`` by using something like this:: |
245 | | |
| 245 | |
246 | 246 | def dictfetchall(cursor): |
247 | 247 | "Returns all rows from a cursor as a dict" |
248 | 248 | desc = cursor.description |
… |
… |
Here is an example of the difference between the two::
|
256 | 256 | >>> cursor.execute("SELECT id, parent_id from test LIMIT 2"); |
257 | 257 | >>> cursor.fetchall() |
258 | 258 | ((54360982L, None), (54360880L, None)) |
259 | | |
| 259 | |
260 | 260 | >>> cursor.execute("SELECT id, parent_id from test LIMIT 2"); |
261 | 261 | >>> dictfetchall(cursor) |
262 | 262 | [{'parent_id': None, 'id': 54360982L}, {'parent_id': None, 'id': 54360880L}] |
… |
… |
transaction containing those calls is closed correctly. See :ref:`the
|
273 | 273 | notes on the requirements of Django's transaction handling |
274 | 274 | <topics-db-transactions-requirements>` for more details. |
275 | 275 | |
276 | | .. versionchanged:: 1.3 |
277 | | |
278 | | Prior to Django 1.3, it was necessary to manually mark a transaction |
279 | | as dirty using ``transaction.set_dirty()`` when using raw SQL calls. |
280 | | |
281 | 276 | Connections and cursors |
282 | 277 | ----------------------- |
283 | 278 | |
-
diff --git a/docs/topics/db/transactions.txt b/docs/topics/db/transactions.txt
index 9928354..4a52c5a 100644
a
|
b
|
database cursor (which is mapped to its own database connection internally).
|
66 | 66 | Controlling transaction management in views |
67 | 67 | =========================================== |
68 | 68 | |
69 | | .. versionchanged:: 1.3 |
70 | | Transaction management context managers are new in Django 1.3. |
71 | | |
72 | 69 | For most people, implicit request-based transactions work wonderfully. However, |
73 | 70 | if you need more fine-grained control over how transactions are managed, you can |
74 | 71 | use a set of functions in ``django.db.transaction`` to control transactions on a |
… |
… |
managers, too.
|
195 | 192 | Requirements for transaction handling |
196 | 193 | ===================================== |
197 | 194 | |
198 | | .. versionadded:: 1.3 |
199 | | |
200 | 195 | Django requires that every transaction that is opened is closed before |
201 | 196 | the completion of a request. If you are using :func:`autocommit` (the |
202 | 197 | default commit mode) or :func:`commit_on_success`, this will be done |
-
diff --git a/docs/topics/email.txt b/docs/topics/email.txt
index 0cc476e..b3d7254 100644
a
|
b
|
The "From:" header of the email will be the value of the
|
119 | 119 | |
120 | 120 | This method exists for convenience and readability. |
121 | 121 | |
122 | | .. versionchanged:: 1.3 |
123 | | |
124 | 122 | If ``html_message`` is provided, the resulting email will be a |
125 | 123 | :mimetype:`multipart/alternative` email with ``message`` as the |
126 | 124 | :mimetype:`text/plain` content type and ``html_message`` as the |
… |
… |
following parameters (in the given order, if positional arguments are used).
|
236 | 234 | All parameters are optional and can be set at any time prior to calling the |
237 | 235 | ``send()`` method. |
238 | 236 | |
239 | | .. versionchanged:: 1.3 |
240 | | The ``cc`` argument was added. |
241 | | |
242 | 237 | * ``subject``: The subject line of the email. |
243 | 238 | |
244 | 239 | * ``body``: The body text. This should be a plain text message. |
-
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt
index 2a83172..7c1771b 100644
a
|
b
|
display two blank forms::
|
35 | 35 | |
36 | 36 | >>> ArticleFormSet = formset_factory(ArticleForm, extra=2) |
37 | 37 | |
38 | | .. versionchanged:: 1.3 |
39 | | |
40 | | Prior to Django 1.3, formset instances were not iterable. To render |
41 | | the formset you iterated over the ``forms`` attribute:: |
42 | | |
43 | | >>> formset = ArticleFormSet() |
44 | | >>> for form in formset.forms: |
45 | | ... print(form.as_table()) |
46 | | |
47 | | Iterating over ``formset.forms`` will render the forms in the order |
48 | | they were created. The default formset iterator also renders the forms |
49 | | in this order, but you can change this order by providing an alternate |
50 | | implementation for the :meth:`__iter__()` method. |
| 38 | Iterating over the ``formset`` will render the forms in the order they were |
| 39 | created. You can change this order by providing an alternate implementation for |
| 40 | the :meth:`__iter__()` method. |
51 | 41 | |
52 | 42 | Formsets can also be indexed into, which returns the corresponding form. If you |
53 | 43 | override ``__iter__``, you will need to also override ``__getitem__`` to have |
-
diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt
index 615dd71..eba65d2 100644
a
|
b
|
return values for dynamic media properties.
|
195 | 195 | Paths in media definitions |
196 | 196 | -------------------------- |
197 | 197 | |
198 | | .. versionchanged:: 1.3 |
199 | | |
200 | 198 | Paths used to specify media can be either relative or absolute. If a path |
201 | 199 | starts with '/', 'http://' or 'https://', it will be interpreted as an absolute |
202 | 200 | path, and left as-is. All other paths will be prepended with the value of |
-
diff --git a/docs/topics/http/middleware.txt b/docs/topics/http/middleware.txt
index fe92bc5..a8347e5 100644
a
|
b
|
middleware is always called on every response.
|
117 | 117 | ``process_template_response`` |
118 | 118 | ----------------------------- |
119 | 119 | |
120 | | .. versionadded:: 1.3 |
121 | | |
122 | 120 | .. method:: process_template_response(self, request, response) |
123 | 121 | |
124 | 122 | ``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is a |
-
diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt
index 10be353..0dc38b1 100644
a
|
b
|
introduce controlled coupling for convenience's sake.
|
17 | 17 | |
18 | 18 | .. function:: render(request, template_name[, dictionary][, context_instance][, content_type][, status][, current_app]) |
19 | 19 | |
20 | | .. versionadded:: 1.3 |
21 | | |
22 | 20 | Combines a given template with a given context dictionary and returns an |
23 | 21 | :class:`~django.http.HttpResponse` object with that rendered text. |
24 | 22 | |
-
diff --git a/docs/topics/http/urls.txt b/docs/topics/http/urls.txt
index 4503bbd..e8a220e 100644
a
|
b
|
A :class:`ResolverMatch` object can also be assigned to a triple::
|
970 | 970 | |
971 | 971 | func, args, kwargs = resolve('/some/path/') |
972 | 972 | |
973 | | .. versionchanged:: 1.3 |
974 | | Triple-assignment exists for backwards-compatibility. Prior to |
975 | | Django 1.3, :func:`~django.core.urlresolvers.resolve` returned a |
976 | | triple containing (view function, arguments, keyword arguments); |
977 | | the :class:`ResolverMatch` object (as well as the namespace and pattern |
978 | | information it provides) is not available in earlier Django releases. |
979 | | |
980 | 973 | One possible use of :func:`~django.core.urlresolvers.resolve` would be to test |
981 | 974 | whether a view would raise a ``Http404`` error before redirecting to it:: |
982 | 975 | |
-
diff --git a/docs/topics/i18n/formatting.txt b/docs/topics/i18n/formatting.txt
index b091647..fc3f37d 100644
a
|
b
|
Template tags
|
80 | 80 | localize |
81 | 81 | ~~~~~~~~ |
82 | 82 | |
83 | | .. versionadded:: 1.3 |
84 | | |
85 | 83 | Enables or disables localization of template variables in the |
86 | 84 | contained block. |
87 | 85 | |
… |
… |
Template filters
|
116 | 114 | localize |
117 | 115 | ~~~~~~~~ |
118 | 116 | |
119 | | .. versionadded:: 1.3 |
120 | | |
121 | 117 | Forces localization of a single value. |
122 | 118 | |
123 | 119 | For example:: |
… |
… |
tag.
|
136 | 132 | unlocalize |
137 | 133 | ~~~~~~~~~~ |
138 | 134 | |
139 | | .. versionadded:: 1.3 |
140 | | |
141 | 135 | Forces a single value to be printed without localization. |
142 | 136 | |
143 | 137 | For example:: |
-
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt
index a7f48fe..aaf728b 100644
a
|
b
|
translations wouldn't be able to reorder placeholder text.
|
134 | 134 | Comments for translators |
135 | 135 | ------------------------ |
136 | 136 | |
137 | | .. versionadded:: 1.3 |
138 | | |
139 | 137 | If you would like to give translators hints about a translatable string, you |
140 | 138 | can add a comment prefixed with the ``Translators`` keyword on the line |
141 | 139 | preceding the string, e.g.:: |
… |
… |
cardinality of the elements at play.
|
255 | 253 | Contextual markers |
256 | 254 | ------------------ |
257 | 255 | |
258 | | .. versionadded:: 1.3 |
259 | | |
260 | 256 | Sometimes words have several meanings, such as ``"May"`` in English, which |
261 | 257 | refers to a month name and to a verb. To enable translators to translate |
262 | 258 | these words correctly in different contexts, you can use the |
… |
… |
Localized names of languages
|
436 | 432 | |
437 | 433 | .. function:: get_language_info |
438 | 434 | |
439 | | .. versionadded:: 1.3 |
440 | | |
441 | 435 | The ``get_language_info()`` function provides detailed information about |
442 | 436 | languages:: |
443 | 437 | |
… |
… |
using the ``context`` keyword:
|
535 | 529 | ``blocktrans`` template tag |
536 | 530 | --------------------------- |
537 | 531 | |
538 | | .. versionchanged:: 1.3 |
539 | | New keyword argument format. |
540 | | |
541 | 532 | Contrarily to the :ttag:`trans` tag, the ``blocktrans`` tag allows you to mark |
542 | 533 | complex sentences consisting of literals and variable content for translation |
543 | 534 | by making use of placeholders:: |
… |
… |
string, so they don't need to be aware of translations.
|
664 | 655 | translator might translate the string ``"yes,no"`` as ``"ja,nein"`` |
665 | 656 | (keeping the comma intact). |
666 | 657 | |
667 | | .. versionadded:: 1.3 |
668 | | |
669 | 658 | You can also retrieve information about any of the available languages using |
670 | 659 | provided template tags and filters. To get information about a single language, |
671 | 660 | use the ``{% get_language_info %}`` tag:: |
… |
… |
directories listed in :setting:`LOCALE_PATHS` have the highest precedence with
|
787 | 776 | the ones appearing first having higher precedence than the ones appearing |
788 | 777 | later. |
789 | 778 | |
790 | | .. versionchanged:: 1.3 |
791 | | Directories listed in :setting:`LOCALE_PATHS` weren't included in the |
792 | | lookup algorithm until version 1.3. |
793 | | |
794 | 779 | Using the JavaScript translation catalog |
795 | 780 | ---------------------------------------- |
796 | 781 | |
-
diff --git a/docs/topics/logging.txt b/docs/topics/logging.txt
index b54a947..ae49af5 100644
a
|
b
|
|
2 | 2 | Logging |
3 | 3 | ======= |
4 | 4 | |
5 | | .. versionadded:: 1.3 |
6 | | |
7 | 5 | .. module:: django.utils.log |
8 | 6 | :synopsis: Logging tools for Django applications |
9 | 7 | |
-
diff --git a/docs/topics/signals.txt b/docs/topics/signals.txt
index db1bcb0..1078d03 100644
a
|
b
|
Now, our ``my_callback`` function will be called each time a request finishes.
|
132 | 132 | Note that ``receiver`` can also take a list of signals to connect a function |
133 | 133 | to. |
134 | 134 | |
135 | | .. versionadded:: 1.3 |
136 | | |
137 | | The ``receiver`` decorator was added in Django 1.3. |
138 | | |
139 | 135 | .. versionchanged:: 1.5 |
140 | 136 | |
141 | 137 | The ability to pass a list of signals was added. |
-
diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt
index c4c7373..7afdbe8 100644
a
|
b
|
module defines tests in class-based approach.
|
73 | 73 | |
74 | 74 | .. admonition:: unittest2 |
75 | 75 | |
76 | | .. versionchanged:: 1.3 |
77 | | |
78 | 76 | Python 2.7 introduced some major changes to the unittest library, |
79 | 77 | adding some extremely useful features. To ensure that every Django |
80 | 78 | project can benefit from these new features, Django ships with a |
… |
… |
two databases.
|
436 | 434 | Controlling creation order for test databases |
437 | 435 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
438 | 436 | |
439 | | .. versionadded:: 1.3 |
440 | | |
441 | 437 | By default, Django will always create the ``default`` database first. |
442 | 438 | However, no guarantees are made on the creation order of any other |
443 | 439 | databases in your test setup. |
… |
… |
Specifically, a ``Response`` object has the following attributes:
|
1001 | 997 | The HTTP status of the response, as an integer. See |
1002 | 998 | :rfc:`2616#section-10` for a full list of HTTP status codes. |
1003 | 999 | |
1004 | | .. versionadded:: 1.3 |
1005 | | |
1006 | 1000 | .. attribute:: templates |
1007 | 1001 | |
1008 | 1002 | A list of ``Template`` instances used to render the final content, in |
… |
… |
The request factory
|
1089 | 1083 | |
1090 | 1084 | .. class:: RequestFactory |
1091 | 1085 | |
1092 | | .. versionadded:: 1.3 |
1093 | | |
1094 | 1086 | The :class:`~django.test.client.RequestFactory` shares the same API as |
1095 | 1087 | the test client. However, instead of behaving like a browser, the |
1096 | 1088 | RequestFactory provides a way to generate a request instance that can |
… |
… |
This means, instead of instantiating a ``Client`` in each test::
|
1327 | 1319 | Customizing the test client |
1328 | 1320 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1329 | 1321 | |
1330 | | .. versionadded:: 1.3 |
1331 | | |
1332 | 1322 | .. attribute:: TestCase.client_class |
1333 | 1323 | |
1334 | 1324 | If you want to use a different ``Client`` class (for example, a subclass |
… |
… |
your test suite.
|
1708 | 1698 | |
1709 | 1699 | .. method:: TestCase.assertQuerysetEqual(qs, values, transform=repr, ordered=True) |
1710 | 1700 | |
1711 | | .. versionadded:: 1.3 |
1712 | | |
1713 | 1701 | Asserts that a queryset ``qs`` returns a particular list of values ``values``. |
1714 | 1702 | |
1715 | 1703 | The comparison of the contents of ``qs`` and ``values`` is performed using |
… |
… |
your test suite.
|
1730 | 1718 | |
1731 | 1719 | .. method:: TestCase.assertNumQueries(num, func, *args, **kwargs) |
1732 | 1720 | |
1733 | | .. versionadded:: 1.3 |
1734 | | |
1735 | 1721 | Asserts that when ``func`` is called with ``*args`` and ``**kwargs`` that |
1736 | 1722 | ``num`` database queries are executed. |
1737 | 1723 | |
… |
… |
Skipping tests
|
1854 | 1840 | |
1855 | 1841 | .. currentmodule:: django.test |
1856 | 1842 | |
1857 | | .. versionadded:: 1.3 |
1858 | | |
1859 | 1843 | The unittest library provides the :func:`@skipIf <unittest.skipIf>` and |
1860 | 1844 | :func:`@skipUnless <unittest.skipUnless>` decorators to allow you to skip tests |
1861 | 1845 | if you know ahead of time that those tests are going to fail under certain |