mirror of
https://github.com/django/django.git
synced 2025-02-01 21:29:24 +00:00
Proofed the 1.6 release notes
This commit is contained in:
parent
b00c6371af
commit
bb863faecd
@ -125,7 +125,7 @@ ModelFormMixin
|
||||
|
||||
This is a required attribute if you are generating the form class
|
||||
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.
|
||||
|
||||
.. attribute:: success_url
|
||||
|
@ -1026,8 +1026,9 @@ subclass::
|
||||
Performs a full-text match. This is like the default search method but
|
||||
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
|
||||
search behaviour.
|
||||
If you need to customize search you can use
|
||||
:meth:`ModelAdmin.get_search_results` to provide additional or alternate
|
||||
search behavior.
|
||||
|
||||
Custom template options
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -137,25 +137,29 @@ into those elements.
|
||||
|
||||
See `a complex example`_ below that uses a description template.
|
||||
|
||||
There is also a way to pass additional information to title and description
|
||||
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::
|
||||
.. method:: Feed.get_context_data(self, **kwargs)
|
||||
|
||||
from mysite.models import Article
|
||||
from django.contrib.syndication.views import Feed
|
||||
.. versionadded:: 1.6
|
||||
|
||||
class ArticlesFeed(Feed):
|
||||
title = "My articles"
|
||||
description_template = "feeds/articles.html"
|
||||
There is also a way to pass additional information to title and description
|
||||
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::
|
||||
|
||||
def items(self):
|
||||
return Article.objects.order_by('-pub_date')[:5]
|
||||
from mysite.models import Article
|
||||
from django.contrib.syndication.views import Feed
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ArticlesFeed, self).get_context_data(**kwargs)
|
||||
context['foo'] = 'bar'
|
||||
return context
|
||||
class ArticlesFeed(Feed):
|
||||
title = "My articles"
|
||||
description_template = "feeds/articles.html"
|
||||
|
||||
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:
|
||||
|
||||
|
@ -135,6 +135,8 @@ configuration in :setting:`DATABASES`::
|
||||
Since Django 1.6, autocommit is turned on by default. This configuration is
|
||||
ignored and can be safely removed.
|
||||
|
||||
.. _database-isolation-level:
|
||||
|
||||
Isolation level
|
||||
---------------
|
||||
|
||||
|
@ -33,7 +33,7 @@ Model Form Functions
|
||||
``fields`` or ``exclude``, or the corresponding attributes on the form's
|
||||
inner ``Meta`` class. See :ref:`modelforms-selecting-fields` for more
|
||||
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.
|
||||
|
||||
|
@ -344,9 +344,9 @@ CSRF_COOKIE_HTTPONLY
|
||||
|
||||
Default: ``False``
|
||||
|
||||
Whether to use HttpOnly flag on the CSRF cookie. If this is set to ``True``,
|
||||
client-side JavaScript will not to be able to access the CSRF cookie. See
|
||||
:setting:`SESSION_COOKIE_HTTPONLY` for details on HttpOnly.
|
||||
Whether to use ``HttpOnly`` flag on the CSRF cookie. If this is set to
|
||||
``True``, client-side JavaScript will not to be able to access the CSRF cookie.
|
||||
See :setting:`SESSION_COOKIE_HTTPONLY` for details on ``HttpOnly``.
|
||||
|
||||
.. setting:: CSRF_COOKIE_NAME
|
||||
|
||||
@ -2315,7 +2315,7 @@ SESSION_COOKIE_HTTPONLY
|
||||
|
||||
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
|
||||
session cookie.
|
||||
|
||||
|
@ -79,9 +79,9 @@ location of tests. The previous runner
|
||||
:setting:`INSTALLED_APPS`.
|
||||
|
||||
The new runner (``django.test.runner.DiscoverRunner``) uses the test discovery
|
||||
features built into unittest2 (the version of unittest in the Python 2.7+
|
||||
standard library, and bundled with Django). With test discovery, tests can be
|
||||
located in any module whose name matches the pattern ``test*.py``.
|
||||
features built into ``unittest2`` (the version of ``unittest`` in the
|
||||
Python 2.7+ standard library, and bundled with Django). With test discovery,
|
||||
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
|
||||
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
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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.
|
||||
|
||||
GeoDjango form widgets
|
||||
@ -127,13 +127,13 @@ Minor features
|
||||
* Authentication backends can raise ``PermissionDenied`` to immediately fail
|
||||
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`.
|
||||
|
||||
* The ``assertQuerysetEqual()`` now checks for undefined order and raises
|
||||
``ValueError`` if undefined order is spotted. The order is seen as
|
||||
undefined if the given ``QuerySet`` isn't ordered and there are more than
|
||||
one ordered values to compare against.
|
||||
* The :meth:`~django.test.TransactionTestCase.assertQuerysetEqual` now checks
|
||||
for undefined order and raises :exc:`~exceptions.ValueError` if undefined
|
||||
order is spotted. The order is seen as undefined if the given ``QuerySet``
|
||||
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
|
||||
:meth:`~django.db.models.query.QuerySet.latest`.
|
||||
@ -146,10 +146,10 @@ Minor features
|
||||
* The default widgets for :class:`~django.forms.EmailField`,
|
||||
:class:`~django.forms.URLField`, :class:`~django.forms.IntegerField`,
|
||||
:class:`~django.forms.FloatField` and :class:`~django.forms.DecimalField` use
|
||||
the new type attributes available in HTML5 (type='email', type='url',
|
||||
type='number'). Note that due to erratic support of the ``number`` input type
|
||||
with localized numbers in current browsers, Django only uses it when numeric
|
||||
fields are not localized.
|
||||
the new type attributes available in HTML5 (``type='email'``, ``type='url'``,
|
||||
``type='number'``). Note that due to erratic support of the ``number``
|
||||
input type with localized numbers in current browsers, Django only uses it
|
||||
when numeric fields are not localized.
|
||||
|
||||
* The ``number`` argument for :ref:`lazy plural translations
|
||||
<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.
|
||||
|
||||
* Syndication feeds (:mod:`django.contrib.syndication`) can now pass extra
|
||||
context through to feed templates using a new `Feed.get_context_data()`
|
||||
callback.
|
||||
context through to feed templates using a new
|
||||
: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
|
||||
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
|
||||
:setting:`TEMPLATE_STRING_IF_INVALID` for variables not present in the
|
||||
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.
|
||||
|
||||
* Generic :class:`~django.contrib.gis.db.models.GeometryField` is now editable
|
||||
@ -210,7 +212,7 @@ Minor features
|
||||
* The documentation contains a :doc:`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
|
||||
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
|
||||
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_confirm`,
|
||||
and :func:`~django.contrib.auth.views.password_change`, you can now pass
|
||||
URL names and they will be resolved.
|
||||
|
||||
* The ``dumpdata`` manage.py command now has a --pks option which will
|
||||
allow users to specify the primary keys of objects they want to dump.
|
||||
This option can only be used with one model.
|
||||
* The :djadmin:`dumpdata` ``manage.py`` command now has a :djadminopt:`--pks`
|
||||
option which will allow users to specify the primary keys of objects they
|
||||
want to dump. This option can only be used with one model.
|
||||
|
||||
* Added ``QuerySet`` methods :meth:`~django.db.models.query.QuerySet.first`
|
||||
and :meth:`~django.db.models.query.QuerySet.last` which are convenience
|
||||
@ -259,16 +263,18 @@ Minor features
|
||||
``None`` if there are no objects matching.
|
||||
|
||||
* :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>`
|
||||
now takes an optional ``for_concrete_model`` argument, which when set to
|
||||
``False`` allows the field to reference proxy models. The default is ``True``
|
||||
to retain the old behavior.
|
||||
now takes an optional
|
||||
:attr:`~django.contrib.contenttypes.generic.GenericForeignKey.for_concrete_model`
|
||||
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
|
||||
stores active language in session if it is not present there. This
|
||||
prevents loss of language settings after session flush, e.g. logout.
|
||||
* The :class:`~django.middleware.locale.LocaleMiddleware` now stores the active
|
||||
language in session if it is not present there. This prevents loss of
|
||||
language settings after session flush, e.g. logout.
|
||||
|
||||
* :exc:`~django.core.exceptions.SuspiciousOperation` has been differentiated
|
||||
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
|
||||
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
|
||||
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));
|
||||
|
||||
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
|
||||
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
|
||||
did not allow ``null`` would cause a database exception at runtime.
|
||||
|
||||
* If a :class:`~django.core.urlresolvers.NoReverseMatch` exception is risen
|
||||
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()
|
||||
raises NoReverseMatch. There is no change to {% url %} tag, it causes
|
||||
template rendering to fail like always when NoReverseMatch 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,
|
||||
``{{ obj.view_href }}`` will cause template rendering to fail if
|
||||
``view_href()`` raises ``NoReverseMatch``. There is no change to the
|
||||
``{% url %}`` tag, it causes template rendering to fail like always when
|
||||
``NoReverseMatch`` is risen.
|
||||
|
||||
* :meth:`django.test.client.Client.logout` now calls
|
||||
: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
|
||||
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
|
||||
@ -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
|
||||
<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
|
||||
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``,
|
||||
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
|
||||
functioning ``ModelForm``. This behaviour also works for earlier Django
|
||||
functioning ``ModelForm``. This behavior also works for earlier Django
|
||||
versions.
|
||||
|
||||
``UpdateView`` and ``CreateView`` without explicit fields
|
||||
@ -821,10 +828,10 @@ deprecated.
|
||||
|
||||
.. _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
|
||||
:ref:`m2m-help_text` above is deprecated and will be removed in Django 1.8.
|
||||
|
||||
|
@ -953,7 +953,7 @@ to test the effects of commit and rollback:
|
||||
key values started at one in :class:`~django.test.TransactionTestCase`
|
||||
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
|
||||
the test has been properly updated.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user