Proofed the 1.6 release notes

This commit is contained in:
Tim Graham 2013-06-05 12:55:50 -04:00
parent b00c6371af
commit bb863faecd
8 changed files with 81 additions and 67 deletions

View File

@ -125,7 +125,7 @@ ModelFormMixin
This is a required attribute if you are generating the form class This is a required attribute if you are generating the form class
automatically (e.g. using ``model``). Omitting this attribute will automatically (e.g. using ``model``). Omitting this attribute will
result in all fields being used, but this behaviour is deprecated result in all fields being used, but this behavior is deprecated
and will be removed in Django 1.8. and will be removed in Django 1.8.
.. attribute:: success_url .. attribute:: success_url

View File

@ -1026,8 +1026,9 @@ subclass::
Performs a full-text match. This is like the default search method but Performs a full-text match. This is like the default search method but
uses an index. Currently this is only available for MySQL. uses an index. Currently this is only available for MySQL.
If you need to customize search you can use :meth:`ModelAdmin.get_search_results` to provide additional or alternate If you need to customize search you can use
search behaviour. :meth:`ModelAdmin.get_search_results` to provide additional or alternate
search behavior.
Custom template options Custom template options
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -137,25 +137,29 @@ into those elements.
See `a complex example`_ below that uses a description template. See `a complex example`_ below that uses a description template.
There is also a way to pass additional information to title and description .. method:: Feed.get_context_data(self, **kwargs)
templates, if you need to supply more than the two variables mentioned
before. You can provide your implementation of ``get_context_data`` method
in your Feed subclass. For example::
from mysite.models import Article .. versionadded:: 1.6
from django.contrib.syndication.views import Feed
class ArticlesFeed(Feed): There is also a way to pass additional information to title and description
title = "My articles" templates, if you need to supply more than the two variables mentioned
description_template = "feeds/articles.html" before. You can provide your implementation of ``get_context_data`` method
in your ``Feed`` subclass. For example::
def items(self): from mysite.models import Article
return Article.objects.order_by('-pub_date')[:5] from django.contrib.syndication.views import Feed
def get_context_data(self, **kwargs): class ArticlesFeed(Feed):
context = super(ArticlesFeed, self).get_context_data(**kwargs) title = "My articles"
context['foo'] = 'bar' description_template = "feeds/articles.html"
return context
def items(self):
return Article.objects.order_by('-pub_date')[:5]
def get_context_data(self, **kwargs):
context = super(ArticlesFeed, self).get_context_data(**kwargs)
context['foo'] = 'bar'
return context
And the template: And the template:

View File

@ -135,6 +135,8 @@ configuration in :setting:`DATABASES`::
Since Django 1.6, autocommit is turned on by default. This configuration is Since Django 1.6, autocommit is turned on by default. This configuration is
ignored and can be safely removed. ignored and can be safely removed.
.. _database-isolation-level:
Isolation level Isolation level
--------------- ---------------

View File

@ -33,7 +33,7 @@ Model Form Functions
``fields`` or ``exclude``, or the corresponding attributes on the form's ``fields`` or ``exclude``, or the corresponding attributes on the form's
inner ``Meta`` class. See :ref:`modelforms-selecting-fields` for more inner ``Meta`` class. See :ref:`modelforms-selecting-fields` for more
information. Omitting any definition of the fields to use will result in all information. Omitting any definition of the fields to use will result in all
fields being used, but this behaviour is deprecated. fields being used, but this behavior is deprecated.
The ``localized_fields`` parameter was added. The ``localized_fields`` parameter was added.

View File

@ -344,9 +344,9 @@ CSRF_COOKIE_HTTPONLY
Default: ``False`` Default: ``False``
Whether to use HttpOnly flag on the CSRF cookie. If this is set to ``True``, Whether to use ``HttpOnly`` flag on the CSRF cookie. If this is set to
client-side JavaScript will not to be able to access the CSRF cookie. See ``True``, client-side JavaScript will not to be able to access the CSRF cookie.
:setting:`SESSION_COOKIE_HTTPONLY` for details on HttpOnly. See :setting:`SESSION_COOKIE_HTTPONLY` for details on ``HttpOnly``.
.. setting:: CSRF_COOKIE_NAME .. setting:: CSRF_COOKIE_NAME
@ -2315,7 +2315,7 @@ SESSION_COOKIE_HTTPONLY
Default: ``True`` Default: ``True``
Whether to use HTTPOnly flag on the session cookie. If this is set to Whether to use ``HTTPOnly`` flag on the session cookie. If this is set to
``True``, client-side JavaScript will not to be able to access the ``True``, client-side JavaScript will not to be able to access the
session cookie. session cookie.

View File

@ -79,9 +79,9 @@ location of tests. The previous runner
:setting:`INSTALLED_APPS`. :setting:`INSTALLED_APPS`.
The new runner (``django.test.runner.DiscoverRunner``) uses the test discovery The new runner (``django.test.runner.DiscoverRunner``) uses the test discovery
features built into unittest2 (the version of unittest in the Python 2.7+ features built into ``unittest2`` (the version of ``unittest`` in the
standard library, and bundled with Django). With test discovery, tests can be Python 2.7+ standard library, and bundled with Django). With test discovery,
located in any module whose name matches the pattern ``test*.py``. tests can be located in any module whose name matches the pattern ``test*.py``.
In addition, the test labels provided to ``./manage.py test`` to nominate In addition, the test labels provided to ``./manage.py test`` to nominate
specific tests to run must now be full Python dotted paths (or directory specific tests to run must now be full Python dotted paths (or directory
@ -111,7 +111,7 @@ Django 1.6 adds support for savepoints in SQLite, with some :ref:`limitations
``BinaryField`` model field ``BinaryField`` model field
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
A new :class:`django.db.models.BinaryField` model field allows to store raw A new :class:`django.db.models.BinaryField` model field allows storage of raw
binary data in the database. binary data in the database.
GeoDjango form widgets GeoDjango form widgets
@ -127,13 +127,13 @@ Minor features
* Authentication backends can raise ``PermissionDenied`` to immediately fail * Authentication backends can raise ``PermissionDenied`` to immediately fail
the authentication chain. the authentication chain.
* The HttpOnly flag can be set on the CSRF cookie with * The ``HttpOnly`` flag can be set on the CSRF cookie with
:setting:`CSRF_COOKIE_HTTPONLY`. :setting:`CSRF_COOKIE_HTTPONLY`.
* The ``assertQuerysetEqual()`` now checks for undefined order and raises * The :meth:`~django.test.TransactionTestCase.assertQuerysetEqual` now checks
``ValueError`` if undefined order is spotted. The order is seen as for undefined order and raises :exc:`~exceptions.ValueError` if undefined
undefined if the given ``QuerySet`` isn't ordered and there are more than order is spotted. The order is seen as undefined if the given ``QuerySet``
one ordered values to compare against. isn't ordered and there are more than one ordered values to compare against.
* Added :meth:`~django.db.models.query.QuerySet.earliest` for symmetry with * Added :meth:`~django.db.models.query.QuerySet.earliest` for symmetry with
:meth:`~django.db.models.query.QuerySet.latest`. :meth:`~django.db.models.query.QuerySet.latest`.
@ -146,10 +146,10 @@ Minor features
* The default widgets for :class:`~django.forms.EmailField`, * The default widgets for :class:`~django.forms.EmailField`,
:class:`~django.forms.URLField`, :class:`~django.forms.IntegerField`, :class:`~django.forms.URLField`, :class:`~django.forms.IntegerField`,
:class:`~django.forms.FloatField` and :class:`~django.forms.DecimalField` use :class:`~django.forms.FloatField` and :class:`~django.forms.DecimalField` use
the new type attributes available in HTML5 (type='email', type='url', the new type attributes available in HTML5 (``type='email'``, ``type='url'``,
type='number'). Note that due to erratic support of the ``number`` input type ``type='number'``). Note that due to erratic support of the ``number``
with localized numbers in current browsers, Django only uses it when numeric input type with localized numbers in current browsers, Django only uses it
fields are not localized. when numeric fields are not localized.
* The ``number`` argument for :ref:`lazy plural translations * The ``number`` argument for :ref:`lazy plural translations
<lazy-plural-translations>` can be provided at translation time rather than <lazy-plural-translations>` can be provided at translation time rather than
@ -185,19 +185,21 @@ Minor features
* The jQuery library embedded in the admin has been upgraded to version 1.9.1. * The jQuery library embedded in the admin has been upgraded to version 1.9.1.
* Syndication feeds (:mod:`django.contrib.syndication`) can now pass extra * Syndication feeds (:mod:`django.contrib.syndication`) can now pass extra
context through to feed templates using a new `Feed.get_context_data()` context through to feed templates using a new
callback. :meth:`Feed.get_context_data()
<django.contrib.syndication.Feed.get_context_data>` callback.
* The admin list columns have a ``column-<field_name>`` class in the HTML * The admin list columns have a ``column-<field_name>`` class in the HTML
so the columns header can be styled with CSS, e.g. to set a column width. so the columns header can be styled with CSS, e.g. to set a column width.
* The isolation level can be customized under PostgreSQL. * The :ref:`isolation level<database-isolation-level>` can be customized under
PostgreSQL.
* The :ttag:`blocktrans` template tag now respects * The :ttag:`blocktrans` template tag now respects
:setting:`TEMPLATE_STRING_IF_INVALID` for variables not present in the :setting:`TEMPLATE_STRING_IF_INVALID` for variables not present in the
context, just like other template constructs. context, just like other template constructs.
* SimpleLazyObjects will now present more helpful representations in shell * ``SimpleLazyObject``\s will now present more helpful representations in shell
debugging situations. debugging situations.
* Generic :class:`~django.contrib.gis.db.models.GeometryField` is now editable * Generic :class:`~django.contrib.gis.db.models.GeometryField` is now editable
@ -210,7 +212,7 @@ Minor features
* The documentation contains a :doc:`deployment checklist * The documentation contains a :doc:`deployment checklist
</howto/deployment/checklist>`. </howto/deployment/checklist>`.
* The :djadmin:`diffsettings` comand gained a ``--all`` option. * The :djadmin:`diffsettings` command gained a ``--all`` option.
* ``django.forms.fields.Field.__init__`` now calls ``super()``, allowing * ``django.forms.fields.Field.__init__`` now calls ``super()``, allowing
field mixins to implement ``__init__()`` methods that will reliably be field mixins to implement ``__init__()`` methods that will reliably be
@ -241,17 +243,19 @@ Minor features
* The ``choices`` argument to model fields now accepts an iterable of iterables * The ``choices`` argument to model fields now accepts an iterable of iterables
instead of requiring an iterable of lists or tuples. instead of requiring an iterable of lists or tuples.
* The reason phrase can be customized in HTTP responses. * The reason phrase can be customized in HTTP responses using
:attr:`~django.http.HttpResponse.reason_phrase`.
* When giving the URL of the next page for :func:`~django.contrib.auth.views.logout`, * When giving the URL of the next page for
:func:`~django.contrib.auth.views.logout`,
:func:`~django.contrib.auth.views.password_reset`, :func:`~django.contrib.auth.views.password_reset`,
:func:`~django.contrib.auth.views.password_reset_confirm`, :func:`~django.contrib.auth.views.password_reset_confirm`,
and :func:`~django.contrib.auth.views.password_change`, you can now pass and :func:`~django.contrib.auth.views.password_change`, you can now pass
URL names and they will be resolved. URL names and they will be resolved.
* The ``dumpdata`` manage.py command now has a --pks option which will * The :djadmin:`dumpdata` ``manage.py`` command now has a :djadminopt:`--pks`
allow users to specify the primary keys of objects they want to dump. option which will allow users to specify the primary keys of objects they
This option can only be used with one model. want to dump. This option can only be used with one model.
* Added ``QuerySet`` methods :meth:`~django.db.models.query.QuerySet.first` * Added ``QuerySet`` methods :meth:`~django.db.models.query.QuerySet.first`
and :meth:`~django.db.models.query.QuerySet.last` which are convenience and :meth:`~django.db.models.query.QuerySet.last` which are convenience
@ -259,16 +263,18 @@ Minor features
``None`` if there are no objects matching. ``None`` if there are no objects matching.
* :class:`~django.views.generic.base.View` and * :class:`~django.views.generic.base.View` and
:class:`~django.views.generic.base.RedirectView` now support HTTP PATCH method. :class:`~django.views.generic.base.RedirectView` now support HTTP ``PATCH``
method.
* :class:`GenericForeignKey <django.contrib.contenttypes.generic.GenericForeignKey>` * :class:`GenericForeignKey <django.contrib.contenttypes.generic.GenericForeignKey>`
now takes an optional ``for_concrete_model`` argument, which when set to now takes an optional
``False`` allows the field to reference proxy models. The default is ``True`` :attr:`~django.contrib.contenttypes.generic.GenericForeignKey.for_concrete_model`
to retain the old behavior. argument, which when set to ``False`` allows the field to reference proxy
models. The default is ``True`` to retain the old behavior.
* The middleware :class:`~django.middleware.locale.LocaleMiddleware` now * The :class:`~django.middleware.locale.LocaleMiddleware` now stores the active
stores active language in session if it is not present there. This language in session if it is not present there. This prevents loss of
prevents loss of language settings after session flush, e.g. logout. language settings after session flush, e.g. logout.
* :exc:`~django.core.exceptions.SuspiciousOperation` has been differentiated * :exc:`~django.core.exceptions.SuspiciousOperation` has been differentiated
into a number of subclasses, and each will log to a matching named logger into a number of subclasses, and each will log to a matching named logger
@ -316,7 +322,7 @@ Behavior changes
Database-level autocommit is enabled by default in Django 1.6. While this Database-level autocommit is enabled by default in Django 1.6. While this
doesn't change the general spirit of Django's transaction management, there doesn't change the general spirit of Django's transaction management, there
are a few known backwards-incompatibities, described in the :ref:`transaction are a few known backwards-incompatibilities, described in the :ref:`transaction
management docs <transactions-upgrading-from-1.5>`. You should review your management docs <transactions-upgrading-from-1.5>`. You should review your
code to determine if you're affected. code to determine if you're affected.
@ -496,7 +502,7 @@ For Oracle, execute this query:
ALTER TABLE DJANGO_COMMENTS MODIFY (ip_address VARCHAR2(39)); ALTER TABLE DJANGO_COMMENTS MODIFY (ip_address VARCHAR2(39));
If you do not apply this change, the behaviour is unchanged: on MySQL, IPv6 If you do not apply this change, the behavior is unchanged: on MySQL, IPv6
addresses are silently truncated; on Oracle, an exception is generated. No addresses are silently truncated; on Oracle, an exception is generated. No
database change is needed for SQLite or PostgreSQL databases. database change is needed for SQLite or PostgreSQL databases.
@ -617,11 +623,12 @@ Miscellaneous
stored as ``null``. Previously, storing a ``blank`` value in a field which stored as ``null``. Previously, storing a ``blank`` value in a field which
did not allow ``null`` would cause a database exception at runtime. did not allow ``null`` would cause a database exception at runtime.
* If a :class:`~django.core.urlresolvers.NoReverseMatch` exception is risen * If a :class:`~django.core.urlresolvers.NoReverseMatch` exception is raised
from a method when rendering a template it is not silenced. For example from a method when rendering a template, it is not silenced. For example,
{{ obj.view_href }} will cause template rendering to fail if view_href() ``{{ obj.view_href }}`` will cause template rendering to fail if
raises NoReverseMatch. There is no change to {% url %} tag, it causes ``view_href()`` raises ``NoReverseMatch``. There is no change to the
template rendering to fail like always when NoReverseMatch is risen. ``{% url %}`` tag, it causes template rendering to fail like always when
``NoReverseMatch`` is risen.
* :meth:`django.test.client.Client.logout` now calls * :meth:`django.test.client.Client.logout` now calls
:meth:`django.contrib.auth.logout` which will send the :meth:`django.contrib.auth.logout` which will send the
@ -738,7 +745,7 @@ from your settings.
If you defined your own form widgets and defined the ``_has_changed`` method If you defined your own form widgets and defined the ``_has_changed`` method
on a widget, you should now define this method on the form field itself. on a widget, you should now define this method on the form field itself.
``module_name`` model meta attribute ``module_name`` model _meta attribute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``Model._meta.module_name`` was renamed to ``model_name``. Despite being a ``Model._meta.module_name`` was renamed to ``model_name``. Despite being a
@ -780,7 +787,7 @@ particular with boolean fields, it is possible for this problem to be completely
invisible. This is a form of `Mass assignment vulnerability invisible. This is a form of `Mass assignment vulnerability
<http://en.wikipedia.org/wiki/Mass_assignment_vulnerability>`_. <http://en.wikipedia.org/wiki/Mass_assignment_vulnerability>`_.
For this reason, this behaviour is deprecated, and using the ``Meta.exclude`` For this reason, this behavior is deprecated, and using the ``Meta.exclude``
option is strongly discouraged. Instead, all fields that are intended for option is strongly discouraged. Instead, all fields that are intended for
inclusion in the form should be listed explicitly in the ``fields`` attribute. inclusion in the form should be listed explicitly in the ``fields`` attribute.
@ -799,7 +806,7 @@ is another option. The admin has its own methods for defining fields
redundant. Instead, simply omit the ``Meta`` inner class of the ``ModelForm``, redundant. Instead, simply omit the ``Meta`` inner class of the ``ModelForm``,
or omit the ``Meta.model`` attribute. Since the ``ModelAdmin`` subclass knows or omit the ``Meta.model`` attribute. Since the ``ModelAdmin`` subclass knows
which model it is for, it can add the necessary attributes to derive a which model it is for, it can add the necessary attributes to derive a
functioning ``ModelForm``. This behaviour also works for earlier Django functioning ``ModelForm``. This behavior also works for earlier Django
versions. versions.
``UpdateView`` and ``CreateView`` without explicit fields ``UpdateView`` and ``CreateView`` without explicit fields
@ -821,10 +828,10 @@ deprecated.
.. _m2m-help_text-deprecation: .. _m2m-help_text-deprecation:
Munging of help text of model form fields for ManyToManyField fields Munging of help text of model form fields for ``ManyToManyField`` fields
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All special handling of the ``help_text`` attibute of ManyToManyField model All special handling of the ``help_text`` attribute of ``ManyToManyField`` model
fields performed by standard model or model form fields as described in fields performed by standard model or model form fields as described in
:ref:`m2m-help_text` above is deprecated and will be removed in Django 1.8. :ref:`m2m-help_text` above is deprecated and will be removed in Django 1.8.

View File

@ -953,7 +953,7 @@ to test the effects of commit and rollback:
key values started at one in :class:`~django.test.TransactionTestCase` key values started at one in :class:`~django.test.TransactionTestCase`
tests. tests.
Tests should not depend on this behaviour, but for legacy tests that do, the Tests should not depend on this behavior, but for legacy tests that do, the
:attr:`~TransactionTestCase.reset_sequences` attribute can be used until :attr:`~TransactionTestCase.reset_sequences` attribute can be used until
the test has been properly updated. the test has been properly updated.