2013-02-28 10:05:26 +00:00
|
|
|
|
========================
|
|
|
|
|
Django 1.5 release notes
|
|
|
|
|
========================
|
2012-03-30 09:33:51 +00:00
|
|
|
|
|
2013-02-26 19:12:27 +00:00
|
|
|
|
*February 26, 2013*
|
|
|
|
|
|
2012-10-25 18:59:13 +00:00
|
|
|
|
Welcome to Django 1.5!
|
|
|
|
|
|
2012-03-30 09:33:51 +00:00
|
|
|
|
These release notes cover the `new features`_, as well
|
|
|
|
|
as some `backwards incompatible changes`_ you'll want to be aware of
|
|
|
|
|
when upgrading from Django 1.4 or older versions. We've also dropped some
|
2014-02-03 13:09:27 +00:00
|
|
|
|
features, which are detailed in :ref:`our deprecation plan
|
|
|
|
|
<deprecation-removed-in-1.5>`, and we've `begun the deprecation process for
|
|
|
|
|
some features`_.
|
2012-03-30 09:33:51 +00:00
|
|
|
|
|
|
|
|
|
.. _`new features`: `What's new in Django 1.5`_
|
|
|
|
|
.. _`backwards incompatible changes`: `Backwards incompatible changes in 1.5`_
|
|
|
|
|
.. _`begun the deprecation process for some features`: `Features deprecated in 1.5`_
|
|
|
|
|
|
2012-10-25 18:59:13 +00:00
|
|
|
|
Overview
|
|
|
|
|
========
|
|
|
|
|
|
|
|
|
|
The biggest new feature in Django 1.5 is the `configurable User model`_. Before
|
|
|
|
|
Django 1.5, applications that wanted to use Django's auth framework
|
|
|
|
|
(:mod:`django.contrib.auth`) were forced to use Django's definition of a "user".
|
|
|
|
|
In Django 1.5, you can now swap out the ``User`` model for one that you write
|
|
|
|
|
yourself. This could be a simple extension to the existing ``User`` model -- for
|
|
|
|
|
example, you could add a Twitter or Facebook ID field -- or you could completely
|
|
|
|
|
replace the ``User`` with one totally customized for your site.
|
|
|
|
|
|
2012-10-25 21:20:55 +00:00
|
|
|
|
Django 1.5 is also the first release with `Python 3 support`_! We're labeling
|
2012-10-25 18:59:13 +00:00
|
|
|
|
this support "experimental" because we don't yet consider it production-ready,
|
|
|
|
|
but everything's in place for you to start porting your apps to Python 3.
|
|
|
|
|
Our next release, Django 1.6, will support Python 3 without reservations.
|
|
|
|
|
|
|
|
|
|
Other notable new features in Django 1.5 include:
|
|
|
|
|
|
|
|
|
|
* `Support for saving a subset of model's fields`_ -
|
|
|
|
|
:meth:`Model.save() <django.db.models.Model.save()>` now accepts an
|
|
|
|
|
``update_fields`` argument, letting you specify which fields are
|
2012-10-25 21:20:55 +00:00
|
|
|
|
written back to the database when you call ``save()``. This can help
|
|
|
|
|
in high-concurrency operations, and can improve performance.
|
2012-10-25 18:59:13 +00:00
|
|
|
|
|
|
|
|
|
* Better `support for streaming responses <#explicit-streaming-responses>`_ via
|
|
|
|
|
the new :class:`~django.http.StreamingHttpResponse` response class.
|
|
|
|
|
|
|
|
|
|
* `GeoDjango`_ now supports PostGIS 2.0.
|
|
|
|
|
|
|
|
|
|
* ... and more; `see below <#what-s-new-in-django-1-5>`_.
|
|
|
|
|
|
|
|
|
|
Wherever possible we try to introduce new features in a backwards-compatible
|
2012-11-18 19:08:45 +00:00
|
|
|
|
manner per :doc:`our API stability policy </misc/api-stability>`.
|
2012-10-25 18:59:13 +00:00
|
|
|
|
However, as with previous releases, Django 1.5 ships with some minor
|
|
|
|
|
`backwards incompatible changes`_; people upgrading from previous versions
|
|
|
|
|
of Django should read that list carefully.
|
|
|
|
|
|
|
|
|
|
One deprecated feature worth noting is the shift to "new-style" :ttag:`url` tag.
|
|
|
|
|
Prior to Django 1.3, syntax like ``{% url myview %}`` was interpreted
|
|
|
|
|
incorrectly (Django considered ``"myview"`` to be a literal name of a view, not
|
|
|
|
|
a template variable named ``myview``). Django 1.3 and above introduced the
|
|
|
|
|
``{% load url from future %}`` syntax to bring in the corrected behavior where
|
|
|
|
|
``myview`` was seen as a variable.
|
|
|
|
|
|
|
|
|
|
The upshot of this is that if you are not using ``{% load url from future %}``
|
|
|
|
|
in your templates, you'll need to change tags like ``{% url myview %}`` to
|
|
|
|
|
``{% url "myview" %}``. If you *were* using ``{% load url from future %}`` you
|
|
|
|
|
can simply remove that line under Django 1.5
|
|
|
|
|
|
2012-03-30 09:33:51 +00:00
|
|
|
|
Python compatibility
|
|
|
|
|
====================
|
|
|
|
|
|
2013-01-08 03:16:46 +00:00
|
|
|
|
Django 1.5 requires Python 2.6.5 or above, though we **highly recommend**
|
2012-11-28 13:19:05 +00:00
|
|
|
|
Python 2.7.3 or above. Support for Python 2.5 and below has been dropped.
|
2012-03-30 09:33:51 +00:00
|
|
|
|
|
|
|
|
|
This change should affect only a small number of Django users, as most
|
|
|
|
|
operating-system vendors today are shipping Python 2.6 or newer as their default
|
|
|
|
|
version. If you're still using Python 2.5, however, you'll need to stick to
|
2012-10-25 18:59:13 +00:00
|
|
|
|
Django 1.4 until you can upgrade your Python version. Per :doc:`our support
|
|
|
|
|
policy </internals/release-process>`, Django 1.4 will continue to receive
|
|
|
|
|
security support until the release of Django 1.6.
|
|
|
|
|
|
|
|
|
|
Django 1.5 does not run on a Jython final release, because Jython's latest
|
|
|
|
|
release doesn't currently support Python 2.6. However, Jython currently does
|
|
|
|
|
offer an alpha release featuring 2.7 support, and Django 1.5 supports that alpha
|
|
|
|
|
release.
|
|
|
|
|
|
|
|
|
|
Python 3 support
|
|
|
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Django 1.5 introduces support for Python 3 - specifically, Python
|
|
|
|
|
3.2 and above. This comes in the form of a **single** codebase; you don't
|
|
|
|
|
need to install a different version of Django on Python 3. This means that
|
2012-11-27 21:49:00 +00:00
|
|
|
|
you can write applications targeted for just Python 2, just Python 3, or single
|
2012-10-25 18:59:13 +00:00
|
|
|
|
applications that support both platforms.
|
|
|
|
|
|
|
|
|
|
However, we're labeling this support "experimental" for now: although it's
|
2012-10-25 21:20:55 +00:00
|
|
|
|
received extensive testing via our automated test suite, it's received very
|
2012-10-25 18:59:13 +00:00
|
|
|
|
little real-world testing. We've done our best to eliminate bugs, but we can't
|
2012-12-28 20:42:58 +00:00
|
|
|
|
be sure we covered all possible uses of Django.
|
|
|
|
|
|
|
|
|
|
Some features of Django aren't available because they depend on third-party
|
|
|
|
|
software that hasn't been ported to Python 3 yet, including:
|
|
|
|
|
|
|
|
|
|
- the MySQL database backend (depends on MySQLdb)
|
2012-12-29 15:35:12 +00:00
|
|
|
|
- :class:`~django.db.models.ImageField` (depends on PIL)
|
2012-12-28 20:42:58 +00:00
|
|
|
|
- :class:`~django.test.LiveServerTestCase` (depends on Selenium WebDriver)
|
|
|
|
|
|
|
|
|
|
Further, Django's more than a web framework; it's an ecosystem of pluggable
|
|
|
|
|
components. At this point, very few third-party applications have been ported
|
|
|
|
|
to Python 3, so it's unlikely that a real-world application will have all its
|
|
|
|
|
dependencies satisfied under Python 3.
|
2012-10-25 18:59:13 +00:00
|
|
|
|
|
|
|
|
|
Thus, we're recommending that Django 1.5 not be used in production under Python
|
2012-10-25 21:20:55 +00:00
|
|
|
|
3. Instead, use this opportunity to begin :doc:`porting applications to Python 3
|
|
|
|
|
</topics/python3>`. If you're an author of a pluggable component, we encourage you
|
2012-10-25 18:59:13 +00:00
|
|
|
|
to start porting now.
|
2012-03-30 09:33:51 +00:00
|
|
|
|
|
2012-10-25 18:59:13 +00:00
|
|
|
|
We plan to offer first-class, production-ready support for Python 3 in our next
|
|
|
|
|
release, Django 1.6.
|
2012-03-30 09:33:51 +00:00
|
|
|
|
|
|
|
|
|
What's new in Django 1.5
|
|
|
|
|
========================
|
|
|
|
|
|
Fixed #3011 -- Added swappable auth.User models.
Thanks to the many people that contributed to the development and review of
this patch, including (but not limited to) Jacob Kaplan-Moss, Anssi
Kääriäinen, Ramiro Morales, Preston Holmes, Josh Ourisman, Thomas Sutton,
and Roger Barnes, as well as the many, many people who have contributed to
the design discussion around this ticket over many years.
Squashed commit of the following:
commit d84749a0f034a0a6906d20df047086b1219040d0
Merge: 531e771 7c11b1a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Wed Sep 26 18:37:04 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 531e7715da545f930c49919a19e954d41c59b446
Merge: 29d1abb 1f84b04
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Wed Sep 26 07:09:23 2012 +0800
Merged recent trunk changes.
commit 29d1abbe351fd5da855fe5ce09e24227d90ddc91
Merge: 8a527dd 54c81a1
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 24 07:49:46 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 8a527dda13c9bec955b1f7e8db5822d1d9b32a01
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 24 07:48:05 2012 +0800
Ensure sequences are reset correctly in the presence of swapped models.
commit e2b6e22f298eb986d74d28b8d9906f37f5ff8eb8
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 17:53:05 2012 +0800
Modifications to the handling and docs for auth forms.
commit 98aba856b534620aea9091f824b442b47d2fdb3c
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 15:28:57 2012 +0800
Improved error handling and docs for get_user_model()
commit 0229209c844f06dfeb33b0b8eeec000c127695b6
Merge: 6494bf9 8599f64
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 14:50:11 2012 +0800
Merged recent Django trunk changes.
commit 6494bf91f2ddaaabec3ec017f2e3131937c35517
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 17 21:38:44 2012 +0800
Improved validation of swappable model settings.
commit 5a04cde342cc860384eb844cfda5af55204564ad
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 17 07:15:14 2012 +0800
Removed some unused imports.
commit ffd535e4136dc54f084b6ac467e81444696e1c8a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 20:31:28 2012 +0800
Corrected attribute access on for get_by_natural_key
commit 913e1ac84c3d9c7c58a9b3bdbbb15ebccd8a8c0a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 20:12:34 2012 +0800
Added test for proxy model safeguards on swappable models.
commit 280bf19e94d0d534d0e51bae485c1842558f4ff4
Merge: dbb3900 935a863
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 18:16:49 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit dbb3900775a99df8b6cb1d7063cf364eab55621a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 18:09:27 2012 +0800
Fixes for Python 3 compatibility.
commit dfd72131d8664615e245aa0f95b82604ba6b3821
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 15:54:30 2012 +0800
Added protection against proxying swapped models.
commit abcb027190e53613e7f1734e77ee185b2587de31
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 15:11:10 2012 +0800
Cleanup and documentation of AbstractUser base class.
commit a9491a87763e307f0eb0dc246f54ac865a6ffb34
Merge: fd8bb4e 08bcb4a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 14:46:49 2012 +0800
Merge commit '08bcb4aec1ed154cefc631b8510ee13e9af0c19d' into t3011
commit fd8bb4e3e498a92d7a8b340f0684d5f088aa4c92
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 14:20:14 2012 +0800
Documentation improvements coming from community review.
commit b550a6d06d016ab6a0198c4cb2dffe9cceabe8a5
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:52:47 2012 +0800
Refactored skipIfCustomUser into the contrib.auth tests.
commit 52a02f11107c3f0d711742b8ca65b75175b79d6a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:46:10 2012 +0800
Refactored common 'get' pattern into manager method.
commit b441a6bbc7d6065175715cb09316b9f13268171b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:41:33 2012 +0800
Added note about backwards incompatible change to admin login messages.
commit 08bcb4aec1ed154cefc631b8510ee13e9af0c19d
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date: Sat Sep 15 18:30:33 2012 +0300
Splitted User to AbstractUser and User
commit d9f5e5addbad5e1a01f67e7358e4f5091c3cad81
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date: Sat Sep 15 18:30:02 2012 +0300
Reworked REQUIRED_FIELDS + create_user() interaction
commit 579f152e4a6e06671e1ac1e59e2b43cf4d764bf4
Merge: 9184972 93e6733
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:18:37 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 918497218c58227f5032873ff97261627b2ceab2
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:18:19 2012 +0800
Deprecate AUTH_PROFILE_MODULE and get_profile().
commit 334cdfc1bb6a6794791497cdefda843bca2ea57a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:00:12 2012 +0800
Added release notes for new swappable User feature.
commit 5d7bb22e8d913b51aba1c3360e7af8b01b6c0ab6
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 19:59:49 2012 +0800
Ensure swapped models can't be queried.
commit 57ac6e3d32605a67581e875b37ec5b2284711a32
Merge: f2ec915 abfba3b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 14:31:54 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit f2ec915b20f81c8afeaa3df25f80689712f720f8
Merge: 1952656 5e99a3d
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 08:29:51 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 19526563b54fa300785c49cfb625c0c6158ced67
Merge: 2c5e833 c4aa26a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 08:22:26 2012 +0800
Merge recent changes from master.
commit 2c5e833a30bef4305d55eacc0703533152f5c427
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 07:53:46 2012 +0800
Corrected admin_views tests following removal of the email fallback on admin logins.
commit 20d1892491839d6ef21f37db4ca136935c2076bf
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 01:00:37 2012 +0800
Added conditional skips for all tests dependent on the default User model
commit 40ea8b888284775481fc1eaadeff267dbd7e3dfa
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 8 23:47:02 2012 +0800
Added documentation for REQUIRED_FIELDS in custom auth.
commit e6aaf659708cf6491f5485d3edfa616cb9214cc0
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 8 23:20:02 2012 +0800
Added first draft of custom User docs.
Thanks to Greg Turner for the initial text.
commit 75118bd242eec87649da2859e8c50a199a8a1dca
Author: Thomas Sutton <me@thomas-sutton.id.au>
Date: Mon Aug 20 11:17:26 2012 +0800
Admin app should not allow username discovery
The admin app login form should not allow users to discover the username
associated with an email address.
commit d088b3af58dad7449fc58493193a327725c57c22
Author: Thomas Sutton <me@thomas-sutton.id.au>
Date: Mon Aug 20 10:32:13 2012 +0800
Admin app login form should use swapped user model
commit 7e82e83d67ee0871a72e1a3a723afdd214fcefc3
Merge: e29c010 39aa890
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Fri Sep 7 23:45:03 2012 +0800
Merged master changes.
commit e29c010beb96ca07697c4e3e0c0d5d3ffdc4c0a3
Merge: 8e3fd70 30bdf22
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Aug 20 13:12:57 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 8e3fd703d02c31a4c3ac9f51f5011d03c0bd47f6
Merge: 507bb50 26e0ba0
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Aug 20 13:09:09 2012 +0800
Merged recent changes from trunk.
commit 507bb50a9291bfcdcfa1198f9fea21d4e3b1e762
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 20:41:37 2012 +0800
Modified auth app so that login with alternate auth app is possible.
commit dabe3628362ab7a4a6c9686dd874803baa997eaa
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 20:10:51 2012 +0800
Modified auth management commands to handle custom user definitions.
commit 7cc0baf89d490c92ef3f1dc909b8090191a1294b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 14:17:28 2012 +0800
Added model Meta option for swappable models, and made auth.User a swappable model
2012-09-26 10:48:09 +00:00
|
|
|
|
Configurable User model
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
In Django 1.5, you can now use your own model as the store for user-related
|
|
|
|
|
data. If your project needs a username with more than 30 characters, or if
|
2012-10-25 20:26:22 +00:00
|
|
|
|
you want to store user's names in a format other than first name/last name,
|
|
|
|
|
or you want to put custom profile information onto your User object, you can
|
Fixed #3011 -- Added swappable auth.User models.
Thanks to the many people that contributed to the development and review of
this patch, including (but not limited to) Jacob Kaplan-Moss, Anssi
Kääriäinen, Ramiro Morales, Preston Holmes, Josh Ourisman, Thomas Sutton,
and Roger Barnes, as well as the many, many people who have contributed to
the design discussion around this ticket over many years.
Squashed commit of the following:
commit d84749a0f034a0a6906d20df047086b1219040d0
Merge: 531e771 7c11b1a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Wed Sep 26 18:37:04 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 531e7715da545f930c49919a19e954d41c59b446
Merge: 29d1abb 1f84b04
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Wed Sep 26 07:09:23 2012 +0800
Merged recent trunk changes.
commit 29d1abbe351fd5da855fe5ce09e24227d90ddc91
Merge: 8a527dd 54c81a1
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 24 07:49:46 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 8a527dda13c9bec955b1f7e8db5822d1d9b32a01
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 24 07:48:05 2012 +0800
Ensure sequences are reset correctly in the presence of swapped models.
commit e2b6e22f298eb986d74d28b8d9906f37f5ff8eb8
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 17:53:05 2012 +0800
Modifications to the handling and docs for auth forms.
commit 98aba856b534620aea9091f824b442b47d2fdb3c
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 15:28:57 2012 +0800
Improved error handling and docs for get_user_model()
commit 0229209c844f06dfeb33b0b8eeec000c127695b6
Merge: 6494bf9 8599f64
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 14:50:11 2012 +0800
Merged recent Django trunk changes.
commit 6494bf91f2ddaaabec3ec017f2e3131937c35517
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 17 21:38:44 2012 +0800
Improved validation of swappable model settings.
commit 5a04cde342cc860384eb844cfda5af55204564ad
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 17 07:15:14 2012 +0800
Removed some unused imports.
commit ffd535e4136dc54f084b6ac467e81444696e1c8a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 20:31:28 2012 +0800
Corrected attribute access on for get_by_natural_key
commit 913e1ac84c3d9c7c58a9b3bdbbb15ebccd8a8c0a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 20:12:34 2012 +0800
Added test for proxy model safeguards on swappable models.
commit 280bf19e94d0d534d0e51bae485c1842558f4ff4
Merge: dbb3900 935a863
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 18:16:49 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit dbb3900775a99df8b6cb1d7063cf364eab55621a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 18:09:27 2012 +0800
Fixes for Python 3 compatibility.
commit dfd72131d8664615e245aa0f95b82604ba6b3821
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 15:54:30 2012 +0800
Added protection against proxying swapped models.
commit abcb027190e53613e7f1734e77ee185b2587de31
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 15:11:10 2012 +0800
Cleanup and documentation of AbstractUser base class.
commit a9491a87763e307f0eb0dc246f54ac865a6ffb34
Merge: fd8bb4e 08bcb4a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 14:46:49 2012 +0800
Merge commit '08bcb4aec1ed154cefc631b8510ee13e9af0c19d' into t3011
commit fd8bb4e3e498a92d7a8b340f0684d5f088aa4c92
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 14:20:14 2012 +0800
Documentation improvements coming from community review.
commit b550a6d06d016ab6a0198c4cb2dffe9cceabe8a5
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:52:47 2012 +0800
Refactored skipIfCustomUser into the contrib.auth tests.
commit 52a02f11107c3f0d711742b8ca65b75175b79d6a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:46:10 2012 +0800
Refactored common 'get' pattern into manager method.
commit b441a6bbc7d6065175715cb09316b9f13268171b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:41:33 2012 +0800
Added note about backwards incompatible change to admin login messages.
commit 08bcb4aec1ed154cefc631b8510ee13e9af0c19d
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date: Sat Sep 15 18:30:33 2012 +0300
Splitted User to AbstractUser and User
commit d9f5e5addbad5e1a01f67e7358e4f5091c3cad81
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date: Sat Sep 15 18:30:02 2012 +0300
Reworked REQUIRED_FIELDS + create_user() interaction
commit 579f152e4a6e06671e1ac1e59e2b43cf4d764bf4
Merge: 9184972 93e6733
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:18:37 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 918497218c58227f5032873ff97261627b2ceab2
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:18:19 2012 +0800
Deprecate AUTH_PROFILE_MODULE and get_profile().
commit 334cdfc1bb6a6794791497cdefda843bca2ea57a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:00:12 2012 +0800
Added release notes for new swappable User feature.
commit 5d7bb22e8d913b51aba1c3360e7af8b01b6c0ab6
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 19:59:49 2012 +0800
Ensure swapped models can't be queried.
commit 57ac6e3d32605a67581e875b37ec5b2284711a32
Merge: f2ec915 abfba3b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 14:31:54 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit f2ec915b20f81c8afeaa3df25f80689712f720f8
Merge: 1952656 5e99a3d
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 08:29:51 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 19526563b54fa300785c49cfb625c0c6158ced67
Merge: 2c5e833 c4aa26a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 08:22:26 2012 +0800
Merge recent changes from master.
commit 2c5e833a30bef4305d55eacc0703533152f5c427
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 07:53:46 2012 +0800
Corrected admin_views tests following removal of the email fallback on admin logins.
commit 20d1892491839d6ef21f37db4ca136935c2076bf
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 01:00:37 2012 +0800
Added conditional skips for all tests dependent on the default User model
commit 40ea8b888284775481fc1eaadeff267dbd7e3dfa
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 8 23:47:02 2012 +0800
Added documentation for REQUIRED_FIELDS in custom auth.
commit e6aaf659708cf6491f5485d3edfa616cb9214cc0
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 8 23:20:02 2012 +0800
Added first draft of custom User docs.
Thanks to Greg Turner for the initial text.
commit 75118bd242eec87649da2859e8c50a199a8a1dca
Author: Thomas Sutton <me@thomas-sutton.id.au>
Date: Mon Aug 20 11:17:26 2012 +0800
Admin app should not allow username discovery
The admin app login form should not allow users to discover the username
associated with an email address.
commit d088b3af58dad7449fc58493193a327725c57c22
Author: Thomas Sutton <me@thomas-sutton.id.au>
Date: Mon Aug 20 10:32:13 2012 +0800
Admin app login form should use swapped user model
commit 7e82e83d67ee0871a72e1a3a723afdd214fcefc3
Merge: e29c010 39aa890
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Fri Sep 7 23:45:03 2012 +0800
Merged master changes.
commit e29c010beb96ca07697c4e3e0c0d5d3ffdc4c0a3
Merge: 8e3fd70 30bdf22
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Aug 20 13:12:57 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 8e3fd703d02c31a4c3ac9f51f5011d03c0bd47f6
Merge: 507bb50 26e0ba0
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Aug 20 13:09:09 2012 +0800
Merged recent changes from trunk.
commit 507bb50a9291bfcdcfa1198f9fea21d4e3b1e762
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 20:41:37 2012 +0800
Modified auth app so that login with alternate auth app is possible.
commit dabe3628362ab7a4a6c9686dd874803baa997eaa
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 20:10:51 2012 +0800
Modified auth management commands to handle custom user definitions.
commit 7cc0baf89d490c92ef3f1dc909b8090191a1294b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 14:17:28 2012 +0800
Added model Meta option for swappable models, and made auth.User a swappable model
2012-09-26 10:48:09 +00:00
|
|
|
|
now do so.
|
|
|
|
|
|
|
|
|
|
If you have a third-party reusable application that references the User model,
|
|
|
|
|
you may need to make some changes to the way you reference User instances. You
|
|
|
|
|
should also document any specific features of the User model that your
|
|
|
|
|
application relies upon.
|
|
|
|
|
|
|
|
|
|
See the :ref:`documentation on custom User models <auth-custom-user>` for
|
|
|
|
|
more details.
|
|
|
|
|
|
2012-05-12 07:24:20 +00:00
|
|
|
|
Support for saving a subset of model's fields
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
The method :meth:`Model.save() <django.db.models.Model.save()>` has a new
|
|
|
|
|
keyword argument ``update_fields``. By using this argument it is possible to
|
|
|
|
|
save only a select list of model's fields. This can be useful for performance
|
|
|
|
|
reasons or when trying to avoid overwriting concurrent changes.
|
|
|
|
|
|
2013-03-22 09:50:45 +00:00
|
|
|
|
Deferred instances (those loaded by ``.only()`` or ``.defer()``) will
|
|
|
|
|
automatically save just the loaded fields. If any field is set manually after
|
|
|
|
|
load, that field will also get updated on save.
|
2012-08-12 19:17:54 +00:00
|
|
|
|
|
2012-05-12 07:24:20 +00:00
|
|
|
|
See the :meth:`Model.save() <django.db.models.Model.save()>` documentation for
|
|
|
|
|
more details.
|
|
|
|
|
|
2012-05-24 11:25:01 +00:00
|
|
|
|
Caching of related model instances
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
When traversing relations, the ORM will avoid re-fetching objects that were
|
|
|
|
|
previously loaded. For example, with the tutorial's models::
|
|
|
|
|
|
|
|
|
|
>>> first_poll = Poll.objects.all()[0]
|
|
|
|
|
>>> first_choice = first_poll.choice_set.all()[0]
|
|
|
|
|
>>> first_choice.poll is first_poll
|
|
|
|
|
True
|
|
|
|
|
|
|
|
|
|
In Django 1.5, the third line no longer triggers a new SQL query to fetch
|
2012-05-25 17:03:15 +00:00
|
|
|
|
``first_choice.poll``; it was set by the second line.
|
2012-05-24 11:25:01 +00:00
|
|
|
|
|
|
|
|
|
For one-to-one relationships, both sides can be cached. For many-to-one
|
|
|
|
|
relationships, only the single side of the relationship can be cached. This
|
|
|
|
|
is particularly helpful in combination with ``prefetch_related``.
|
|
|
|
|
|
2012-10-23 20:25:38 +00:00
|
|
|
|
.. _explicit-streaming-responses:
|
|
|
|
|
|
2012-10-20 15:40:14 +00:00
|
|
|
|
Explicit support for streaming responses
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Before Django 1.5, it was possible to create a streaming response by passing
|
|
|
|
|
an iterator to :class:`~django.http.HttpResponse`. But this was unreliable:
|
|
|
|
|
any middleware that accessed the :attr:`~django.http.HttpResponse.content`
|
|
|
|
|
attribute would consume the iterator prematurely.
|
|
|
|
|
|
|
|
|
|
You can now explicitly generate a streaming response with the new
|
|
|
|
|
:class:`~django.http.StreamingHttpResponse` class. This class exposes a
|
|
|
|
|
:class:`~django.http.StreamingHttpResponse.streaming_content` attribute which
|
|
|
|
|
is an iterator.
|
|
|
|
|
|
|
|
|
|
Since :class:`~django.http.StreamingHttpResponse` does not have a ``content``
|
2012-10-23 20:25:38 +00:00
|
|
|
|
attribute, middleware that needs access to the response content must test for
|
2012-10-20 15:40:14 +00:00
|
|
|
|
streaming responses and behave accordingly. See :ref:`response-middleware` for
|
|
|
|
|
more information.
|
|
|
|
|
|
2012-06-07 07:59:14 +00:00
|
|
|
|
``{% verbatim %}`` template tag
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2015-04-30 19:39:29 +00:00
|
|
|
|
To make it easier to deal with JavaScript templates which collide with Django's
|
2012-06-07 07:59:14 +00:00
|
|
|
|
syntax, you can now use the :ttag:`verbatim` block tag to avoid parsing the
|
|
|
|
|
tag's content.
|
|
|
|
|
|
2012-07-04 21:34:55 +00:00
|
|
|
|
Retrieval of ``ContentType`` instances associated with proxy models
|
2012-05-29 21:55:20 +00:00
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2012-06-08 20:52:43 +00:00
|
|
|
|
The methods :meth:`ContentTypeManager.get_for_model() <django.contrib.contenttypes.models.ContentTypeManager.get_for_model()>`
|
|
|
|
|
and :meth:`ContentTypeManager.get_for_models() <django.contrib.contenttypes.models.ContentTypeManager.get_for_models()>`
|
|
|
|
|
have a new keyword argument – respectively ``for_concrete_model`` and ``for_concrete_models``.
|
2012-10-25 21:20:55 +00:00
|
|
|
|
By passing ``False`` using this argument it is now possible to retrieve the
|
2012-06-08 20:52:43 +00:00
|
|
|
|
:class:`ContentType <django.contrib.contenttypes.models.ContentType>`
|
2012-05-29 21:55:20 +00:00
|
|
|
|
associated with proxy models.
|
|
|
|
|
|
2012-08-18 13:46:17 +00:00
|
|
|
|
New ``view`` variable in class-based views context
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2012-09-29 09:01:08 +00:00
|
|
|
|
|
2012-08-18 13:46:17 +00:00
|
|
|
|
In all :doc:`generic class-based views </topics/class-based-views/index>`
|
|
|
|
|
(or any class-based view inheriting from ``ContextMixin``), the context dictionary
|
|
|
|
|
contains a ``view`` variable that points to the ``View`` instance.
|
|
|
|
|
|
2012-09-29 09:01:08 +00:00
|
|
|
|
GeoDjango
|
|
|
|
|
~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
* :class:`~django.contrib.gis.geos.LineString` and
|
|
|
|
|
:class:`~django.contrib.gis.geos.MultiLineString` GEOS objects now support the
|
|
|
|
|
:meth:`~django.contrib.gis.geos.GEOSGeometry.interpolate()` and
|
|
|
|
|
:meth:`~django.contrib.gis.geos.GEOSGeometry.project()` methods
|
|
|
|
|
(so-called linear referencing).
|
|
|
|
|
|
2013-03-22 09:50:45 +00:00
|
|
|
|
* The ``wkb`` and ``hex`` properties of
|
|
|
|
|
:class:`~django.contrib.gis.geos.GEOSGeometry` objects preserve the Z
|
|
|
|
|
dimension.
|
2012-09-22 09:55:37 +00:00
|
|
|
|
|
2012-09-29 12:45:56 +00:00
|
|
|
|
* Support for PostGIS 2.0 has been added and support for GDAL < 1.5 has been
|
|
|
|
|
dropped.
|
2012-09-29 09:01:08 +00:00
|
|
|
|
|
2012-12-15 13:29:46 +00:00
|
|
|
|
New tutorials
|
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Additions to the docs include a revamped :doc:`Tutorial 3</intro/tutorial03>`
|
|
|
|
|
and a new :doc:`tutorial on testing</intro/tutorial05>`. A new section,
|
|
|
|
|
"Advanced Tutorials", offers :doc:`How to write reusable apps
|
|
|
|
|
</intro/reusable-apps>` as well as a step-by-step guide for new contributors in
|
|
|
|
|
:doc:`Writing your first patch for Django </intro/contributing>`.
|
|
|
|
|
|
2012-04-10 20:49:45 +00:00
|
|
|
|
Minor features
|
|
|
|
|
~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Django 1.5 also includes several smaller improvements worth noting:
|
|
|
|
|
|
|
|
|
|
* The template engine now interprets ``True``, ``False`` and ``None`` as the
|
|
|
|
|
corresponding Python objects.
|
|
|
|
|
|
2012-04-29 13:37:23 +00:00
|
|
|
|
* :mod:`django.utils.timezone` provides a helper for converting aware
|
2012-04-29 18:33:54 +00:00
|
|
|
|
datetimes between time zones. See :func:`~django.utils.timezone.localtime`.
|
2012-04-29 13:37:23 +00:00
|
|
|
|
|
2012-05-17 12:03:19 +00:00
|
|
|
|
* The generic views support OPTIONS requests.
|
|
|
|
|
|
2012-05-26 18:50:44 +00:00
|
|
|
|
* Management commands do not raise ``SystemExit`` any more when called by code
|
|
|
|
|
from :ref:`call_command <call-command>`. Any exception raised by the command
|
|
|
|
|
(mostly :ref:`CommandError <ref-command-exceptions>`) is propagated.
|
|
|
|
|
|
2013-02-09 09:17:26 +00:00
|
|
|
|
Moreover, when you output errors or messages in your custom commands, you
|
|
|
|
|
should now use ``self.stdout.write('message')`` and
|
|
|
|
|
``self.stderr.write('error')`` (see the note on
|
|
|
|
|
:ref:`management commands output <management-commands-output>`).
|
|
|
|
|
|
2012-05-26 14:15:45 +00:00
|
|
|
|
* The dumpdata management command outputs one row at a time, preventing
|
|
|
|
|
out-of-memory errors when dumping large datasets.
|
|
|
|
|
|
2012-05-10 20:19:01 +00:00
|
|
|
|
* In the localflavor for Canada, "pq" was added to the acceptable codes for
|
|
|
|
|
Quebec. It's an old abbreviation.
|
|
|
|
|
|
2012-06-08 10:00:51 +00:00
|
|
|
|
* The :ref:`receiver <connecting-receiver-functions>` decorator is now able to
|
|
|
|
|
connect to more than one signal by supplying a list of signals.
|
|
|
|
|
|
2012-09-07 16:42:06 +00:00
|
|
|
|
* In the admin, you can now filter users by groups which they are members of.
|
|
|
|
|
|
2012-04-29 01:22:05 +00:00
|
|
|
|
* :meth:`QuerySet.bulk_create()
|
2012-08-06 21:28:58 +00:00
|
|
|
|
<django.db.models.query.QuerySet.bulk_create>` now has a batch_size
|
2012-04-29 01:22:05 +00:00
|
|
|
|
argument. By default the batch_size is unlimited except for SQLite where
|
|
|
|
|
single batch is limited so that 999 parameters per query isn't exceeded.
|
|
|
|
|
|
2012-09-08 22:55:29 +00:00
|
|
|
|
* The :setting:`LOGIN_URL` and :setting:`LOGIN_REDIRECT_URL` settings now also
|
|
|
|
|
accept view function names and
|
|
|
|
|
:ref:`named URL patterns <naming-url-patterns>`. This allows you to reduce
|
|
|
|
|
configuration duplication. More information can be found in the
|
|
|
|
|
:func:`~django.contrib.auth.decorators.login_required` documentation.
|
|
|
|
|
|
2012-09-24 05:48:13 +00:00
|
|
|
|
* Django now provides a mod_wsgi :doc:`auth handler
|
2012-09-29 19:57:50 +00:00
|
|
|
|
</howto/deployment/wsgi/apache-auth>`.
|
2012-09-24 05:48:13 +00:00
|
|
|
|
|
2012-09-20 15:51:30 +00:00
|
|
|
|
* The :meth:`QuerySet.delete() <django.db.models.query.QuerySet.delete>`
|
|
|
|
|
and :meth:`Model.delete() <django.db.models.Model.delete()>` can now take
|
|
|
|
|
fast-path in some cases. The fast-path allows for less queries and less
|
|
|
|
|
objects fetched into memory. See :meth:`QuerySet.delete()
|
|
|
|
|
<django.db.models.query.QuerySet.delete>` for details.
|
|
|
|
|
|
2012-09-27 13:06:58 +00:00
|
|
|
|
* An instance of :class:`~django.core.urlresolvers.ResolverMatch` is stored on
|
|
|
|
|
the request as ``resolver_match``.
|
|
|
|
|
|
2013-03-22 09:50:45 +00:00
|
|
|
|
* By default, all logging messages reaching the ``django`` logger when
|
|
|
|
|
:setting:`DEBUG` is ``True`` are sent to the console (unless you redefine the
|
2012-09-26 17:56:21 +00:00
|
|
|
|
logger in your :setting:`LOGGING` setting).
|
|
|
|
|
|
2012-09-30 15:13:23 +00:00
|
|
|
|
* When using :class:`~django.template.RequestContext`, it is now possible to
|
|
|
|
|
look up permissions by using ``{% if 'someapp.someperm' in perms %}``
|
|
|
|
|
in templates.
|
|
|
|
|
|
2012-09-30 21:16:14 +00:00
|
|
|
|
* It's not required any more to have ``404.html`` and ``500.html`` templates in
|
|
|
|
|
the root templates directory. Django will output some basic error messages for
|
|
|
|
|
both situations when those templates are not found. Of course, it's still
|
|
|
|
|
recommended as good practice to provide those templates in order to present
|
|
|
|
|
pretty error pages to the user.
|
|
|
|
|
|
2012-07-12 01:43:15 +00:00
|
|
|
|
* :mod:`django.contrib.auth` provides a new signal that is emitted
|
|
|
|
|
whenever a user fails to login successfully. See
|
|
|
|
|
:data:`~django.contrib.auth.signals.user_login_failed`
|
|
|
|
|
|
2013-03-22 09:50:45 +00:00
|
|
|
|
* The loaddata management command now supports an
|
|
|
|
|
:djadminopt:`--ignorenonexistent` option to ignore data for fields that no
|
|
|
|
|
longer exist.
|
2012-09-30 12:34:13 +00:00
|
|
|
|
|
2012-10-06 11:14:11 +00:00
|
|
|
|
* :meth:`~django.test.SimpleTestCase.assertXMLEqual` and
|
|
|
|
|
:meth:`~django.test.SimpleTestCase.assertXMLNotEqual` new assertions allow
|
|
|
|
|
you to test equality for XML content at a semantic level, without caring for
|
|
|
|
|
syntax differences (spaces, attribute order, etc.).
|
|
|
|
|
|
2012-09-09 20:25:06 +00:00
|
|
|
|
* RemoteUserMiddleware now forces logout when the REMOTE_USER header
|
|
|
|
|
disappears during the same browser session.
|
|
|
|
|
|
2012-10-30 20:59:23 +00:00
|
|
|
|
* The :ref:`cache-based session backend <cached-sessions-backend>` can store
|
|
|
|
|
session data in a non-default cache.
|
|
|
|
|
|
2012-11-04 23:41:33 +00:00
|
|
|
|
* Multi-column indexes can now be created on models. Read the
|
|
|
|
|
:attr:`~django.db.models.Options.index_together` documentation for more
|
2012-11-04 23:44:20 +00:00
|
|
|
|
information.
|
2012-11-04 23:41:33 +00:00
|
|
|
|
|
2012-11-17 00:50:50 +00:00
|
|
|
|
* During Django's logging configuration verbose Deprecation warnings are
|
|
|
|
|
enabled and warnings are captured into the logging system. Logged warnings
|
|
|
|
|
are routed through the ``console`` logging handler, which by default requires
|
|
|
|
|
:setting:`DEBUG` to be True for output to be generated. The result is that
|
|
|
|
|
DeprecationWarnings should be printed to the console in development
|
|
|
|
|
environments the way they have been in Python versions < 2.7.
|
|
|
|
|
|
2012-11-17 21:53:31 +00:00
|
|
|
|
* The API for :meth:`django.contrib.admin.ModelAdmin.message_user` method has
|
|
|
|
|
been modified to accept additional arguments adding capabilities similar to
|
|
|
|
|
:func:`django.contrib.messages.add_message`. This is useful for generating
|
|
|
|
|
error messages from admin actions.
|
|
|
|
|
|
2012-11-25 19:39:23 +00:00
|
|
|
|
* The admin's list filters can now be customized per-request thanks to the new
|
|
|
|
|
:meth:`django.contrib.admin.ModelAdmin.get_list_filter` method.
|
|
|
|
|
|
2012-03-30 09:33:51 +00:00
|
|
|
|
Backwards incompatible changes in 1.5
|
|
|
|
|
=====================================
|
|
|
|
|
|
2012-04-14 06:40:20 +00:00
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
|
|
In addition to the changes outlined in this section, be sure to review the
|
2014-05-29 22:58:12 +00:00
|
|
|
|
:ref:`deprecation plan <deprecation-removed-in-1.5>` for any features that
|
2012-04-29 18:33:54 +00:00
|
|
|
|
have been removed. If you haven't updated your code within the
|
2012-04-14 06:40:20 +00:00
|
|
|
|
deprecation timeline for a given feature, its removal may appear as a
|
|
|
|
|
backwards incompatible change.
|
|
|
|
|
|
2013-02-09 17:17:01 +00:00
|
|
|
|
``ALLOWED_HOSTS`` required in production
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
The new :setting:`ALLOWED_HOSTS` setting validates the request's ``Host``
|
|
|
|
|
header and protects against host-poisoning attacks. This setting is now
|
|
|
|
|
required whenever :setting:`DEBUG` is ``False``, or else
|
|
|
|
|
:meth:`django.http.HttpRequest.get_host()` will raise
|
|
|
|
|
:exc:`~django.core.exceptions.SuspiciousOperation`. For more details see the
|
|
|
|
|
:setting:`full documentation<ALLOWED_HOSTS>` for the new setting.
|
|
|
|
|
|
2012-12-15 12:13:45 +00:00
|
|
|
|
Managers on abstract models
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Abstract models are able to define a custom manager, and that manager
|
|
|
|
|
:ref:`will be inherited by any concrete models extending the abstract model
|
|
|
|
|
<custom-managers-and-inheritance>`. However, if you try to use the abstract
|
|
|
|
|
model to call a method on the manager, an exception will now be raised.
|
|
|
|
|
Previously, the call would have been permitted, but would have failed as soon
|
|
|
|
|
as any database operation was attempted (usually with a "table does not exist"
|
|
|
|
|
error from the database).
|
|
|
|
|
|
|
|
|
|
If you have functionality on a manager that you have been invoking using
|
|
|
|
|
the abstract class, you should migrate that logic to a Python
|
|
|
|
|
``staticmethod`` or ``classmethod`` on the abstract class.
|
|
|
|
|
|
2012-05-24 11:02:19 +00:00
|
|
|
|
Context in year archive class-based views
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
For consistency with the other date-based generic views,
|
|
|
|
|
:class:`~django.views.generic.dates.YearArchiveView` now passes ``year`` in
|
|
|
|
|
the context as a :class:`datetime.date` rather than a string. If you are
|
|
|
|
|
using ``{{ year }}`` in your templates, you must replace it with ``{{
|
|
|
|
|
year|date:"Y" }}``.
|
|
|
|
|
|
|
|
|
|
``next_year`` and ``previous_year`` were also added in the context. They are
|
|
|
|
|
calculated according to ``allow_empty`` and ``allow_future``.
|
|
|
|
|
|
2012-09-22 09:45:51 +00:00
|
|
|
|
Context in year and month archive class-based views
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
:class:`~django.views.generic.dates.YearArchiveView` and
|
|
|
|
|
:class:`~django.views.generic.dates.MonthArchiveView` were documented to
|
|
|
|
|
provide a ``date_list`` sorted in ascending order in the context, like their
|
|
|
|
|
function-based predecessors, but it actually was in descending order. In 1.5,
|
|
|
|
|
the documented order was restored. You may want to add (or remove) the
|
|
|
|
|
``reversed`` keyword when you're iterating on ``date_list`` in a template::
|
|
|
|
|
|
|
|
|
|
{% for date in date_list reversed %}
|
|
|
|
|
|
|
|
|
|
:class:`~django.views.generic.dates.ArchiveIndexView` still provides a
|
|
|
|
|
``date_list`` in descending order.
|
|
|
|
|
|
2012-08-18 11:52:05 +00:00
|
|
|
|
Context in TemplateView
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
For consistency with the design of the other generic views,
|
|
|
|
|
:class:`~django.views.generic.base.TemplateView` no longer passes a ``params``
|
|
|
|
|
dictionary into the context, instead passing the variables from the URLconf
|
|
|
|
|
directly into the context.
|
|
|
|
|
|
2012-10-20 12:33:57 +00:00
|
|
|
|
Non-form data in HTTP requests
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
:attr:`request.POST <django.http.HttpRequest.POST>` will no longer include data
|
|
|
|
|
posted via HTTP requests with non form-specific content-types in the header.
|
|
|
|
|
In prior versions, data posted with content-types other than
|
|
|
|
|
``multipart/form-data`` or ``application/x-www-form-urlencoded`` would still
|
|
|
|
|
end up represented in the :attr:`request.POST <django.http.HttpRequest.POST>`
|
|
|
|
|
attribute. Developers wishing to access the raw POST data for these cases,
|
|
|
|
|
should use the :attr:`request.body <django.http.HttpRequest.body>` attribute
|
|
|
|
|
instead.
|
|
|
|
|
|
2012-12-30 14:19:22 +00:00
|
|
|
|
:data:`~django.core.signals.request_finished` signal
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Django used to send the :data:`~django.core.signals.request_finished` signal
|
|
|
|
|
as soon as the view function returned a response. This interacted badly with
|
|
|
|
|
:ref:`streaming responses <httpresponse-streaming>` that delay content
|
|
|
|
|
generation.
|
|
|
|
|
|
|
|
|
|
This signal is now sent after the content is fully consumed by the WSGI
|
|
|
|
|
gateway. This might be backwards incompatible if you rely on the signal being
|
|
|
|
|
fired before sending the response content to the client. If you do, you should
|
2013-06-03 13:53:04 +00:00
|
|
|
|
consider using :doc:`middleware </topics/http/middleware>` instead.
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
Some WSGI servers and middleware do not always call ``close`` on the
|
|
|
|
|
response object after handling a request, most notably uWSGI prior to 1.2.6
|
|
|
|
|
and Sentry's error reporting middleware up to 2.0.7. In those cases the
|
|
|
|
|
``request_finished`` signal isn't sent at all. This can result in idle
|
|
|
|
|
connections to database and memcache servers.
|
2012-12-30 14:19:22 +00:00
|
|
|
|
|
2012-05-25 17:03:15 +00:00
|
|
|
|
OPTIONS, PUT and DELETE requests in the test client
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Unlike GET and POST, these HTTP methods aren't implemented by web browsers.
|
|
|
|
|
Rather, they're used in APIs, which transfer data in various formats such as
|
|
|
|
|
JSON or XML. Since such requests may contain arbitrary data, Django doesn't
|
|
|
|
|
attempt to decode their body.
|
|
|
|
|
|
|
|
|
|
However, the test client used to build a query string for OPTIONS and DELETE
|
|
|
|
|
requests like for GET, and a request body for PUT requests like for POST. This
|
|
|
|
|
encoding was arbitrary and inconsistent with Django's behavior when it
|
|
|
|
|
receives the requests, so it was removed in Django 1.5.
|
|
|
|
|
|
|
|
|
|
If you were using the ``data`` parameter in an OPTIONS or a DELETE request,
|
|
|
|
|
you must convert it to a query string and append it to the ``path`` parameter.
|
|
|
|
|
|
|
|
|
|
If you were using the ``data`` parameter in a PUT request without a
|
|
|
|
|
``content_type``, you must encode your data before passing it to the test
|
|
|
|
|
client and set the ``content_type`` argument.
|
|
|
|
|
|
2012-08-20 19:21:00 +00:00
|
|
|
|
.. _simplejson-incompatibilities:
|
|
|
|
|
|
2014-10-24 19:35:20 +00:00
|
|
|
|
System version of ``simplejson`` no longer used
|
2012-08-20 19:21:00 +00:00
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
:ref:`As explained below <simplejson-deprecation>`, Django 1.5 deprecates
|
2012-12-25 14:56:22 +00:00
|
|
|
|
``django.utils.simplejson`` in favor of Python 2.6's built-in :mod:`json`
|
2012-08-20 19:21:00 +00:00
|
|
|
|
module. In theory, this change is harmless. Unfortunately, because of
|
2014-10-24 19:35:20 +00:00
|
|
|
|
incompatibilities between versions of ``simplejson``, it may trigger errors
|
2012-08-20 19:21:00 +00:00
|
|
|
|
in some circumstances.
|
|
|
|
|
|
2012-12-25 14:56:22 +00:00
|
|
|
|
JSON-related features in Django 1.4 always used ``django.utils.simplejson``.
|
2012-08-20 19:21:00 +00:00
|
|
|
|
This module was actually:
|
|
|
|
|
|
2014-10-24 19:35:20 +00:00
|
|
|
|
- A system version of ``simplejson``, if one was available (ie. ``import
|
2012-08-20 19:21:00 +00:00
|
|
|
|
simplejson`` works), if it was more recent than Django's built-in copy or it
|
|
|
|
|
had the C speedups, or
|
|
|
|
|
- The :mod:`json` module from the standard library, if it was available (ie.
|
|
|
|
|
Python 2.6 or greater), or
|
2014-10-24 19:35:20 +00:00
|
|
|
|
- A built-in copy of version 2.0.7 of ``simplejson``.
|
2012-08-20 19:21:00 +00:00
|
|
|
|
|
|
|
|
|
In Django 1.5, those features use Python's :mod:`json` module, which is based
|
2014-10-24 19:35:20 +00:00
|
|
|
|
on version 2.0.9 of ``simplejson``.
|
2012-08-20 19:21:00 +00:00
|
|
|
|
|
|
|
|
|
There are no known incompatibilities between Django's copy of version 2.0.7 and
|
|
|
|
|
Python's copy of version 2.0.9. However, there are some incompatibilities
|
2014-10-24 19:35:20 +00:00
|
|
|
|
between other versions of ``simplejson``:
|
2012-08-20 19:21:00 +00:00
|
|
|
|
|
2014-10-24 19:35:20 +00:00
|
|
|
|
- While the ``simplejson`` API is documented as always returning unicode
|
2012-08-20 19:21:00 +00:00
|
|
|
|
strings, the optional C implementation can return a byte string. This was
|
|
|
|
|
fixed in Python 2.7.
|
2014-10-24 19:35:20 +00:00
|
|
|
|
- ``simplejson.JSONEncoder`` gained a ``namedtuple_as_object`` keyword
|
2012-08-20 19:21:00 +00:00
|
|
|
|
argument in version 2.2.
|
|
|
|
|
|
|
|
|
|
More information on these incompatibilities is available in `ticket #18023`_.
|
|
|
|
|
|
2014-10-24 19:35:20 +00:00
|
|
|
|
The net result is that, if you have installed ``simplejson`` and your code
|
2012-08-20 19:21:00 +00:00
|
|
|
|
uses Django's serialization internals directly -- for instance
|
2012-12-29 15:35:12 +00:00
|
|
|
|
``django.core.serializers.json.DjangoJSONEncoder``, the switch from
|
2014-10-24 19:35:20 +00:00
|
|
|
|
``simplejson`` to :mod:`json` could break your code. (In general, changes to
|
2012-08-20 19:21:00 +00:00
|
|
|
|
internals aren't documented; we're making an exception here.)
|
|
|
|
|
|
|
|
|
|
At this point, the maintainers of Django believe that using :mod:`json` from
|
|
|
|
|
the standard library offers the strongest guarantee of backwards-compatibility.
|
|
|
|
|
They recommend to use it from now on.
|
|
|
|
|
|
|
|
|
|
.. _ticket #18023: https://code.djangoproject.com/ticket/18023#comment:10
|
|
|
|
|
|
2012-06-06 08:53:16 +00:00
|
|
|
|
String types of hasher method parameters
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
If you have written a :ref:`custom password hasher <auth_password_storage>`,
|
|
|
|
|
your ``encode()``, ``verify()`` or ``safe_summary()`` methods should accept
|
|
|
|
|
Unicode parameters (``password``, ``salt`` or ``encoded``). If any of the
|
|
|
|
|
hashing methods need byte strings, you can use the
|
2012-08-28 18:59:56 +00:00
|
|
|
|
:func:`~django.utils.encoding.force_bytes` utility to encode the strings.
|
2012-06-06 08:53:16 +00:00
|
|
|
|
|
2012-06-09 15:55:24 +00:00
|
|
|
|
Validation of previous_page_number and next_page_number
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
When using :doc:`object pagination </topics/pagination>`,
|
|
|
|
|
the ``previous_page_number()`` and ``next_page_number()`` methods of the
|
|
|
|
|
:class:`~django.core.paginator.Page` object did not check if the returned
|
|
|
|
|
number was inside the existing page range.
|
2012-12-29 15:35:12 +00:00
|
|
|
|
It does check it now and raises an :exc:`~django.core.paginator.InvalidPage`
|
|
|
|
|
exception when the number is either too low or too high.
|
2012-06-09 15:55:24 +00:00
|
|
|
|
|
2012-05-26 20:19:13 +00:00
|
|
|
|
Behavior of autocommit database option on PostgreSQL changed
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
PostgreSQL's autocommit option didn't work as advertised previously. It did
|
|
|
|
|
work for single transaction block, but after the first block was left the
|
|
|
|
|
autocommit behavior was never restored. This bug is now fixed in 1.5. While
|
|
|
|
|
this is only a bug fix, it is worth checking your applications behavior if
|
|
|
|
|
you are using PostgreSQL together with the autocommit option.
|
|
|
|
|
|
2012-07-05 15:09:48 +00:00
|
|
|
|
Session not saved on 500 responses
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Django's session middleware will skip saving the session data if the
|
|
|
|
|
response's status code is 500.
|
|
|
|
|
|
Fixed #3011 -- Added swappable auth.User models.
Thanks to the many people that contributed to the development and review of
this patch, including (but not limited to) Jacob Kaplan-Moss, Anssi
Kääriäinen, Ramiro Morales, Preston Holmes, Josh Ourisman, Thomas Sutton,
and Roger Barnes, as well as the many, many people who have contributed to
the design discussion around this ticket over many years.
Squashed commit of the following:
commit d84749a0f034a0a6906d20df047086b1219040d0
Merge: 531e771 7c11b1a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Wed Sep 26 18:37:04 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 531e7715da545f930c49919a19e954d41c59b446
Merge: 29d1abb 1f84b04
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Wed Sep 26 07:09:23 2012 +0800
Merged recent trunk changes.
commit 29d1abbe351fd5da855fe5ce09e24227d90ddc91
Merge: 8a527dd 54c81a1
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 24 07:49:46 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 8a527dda13c9bec955b1f7e8db5822d1d9b32a01
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 24 07:48:05 2012 +0800
Ensure sequences are reset correctly in the presence of swapped models.
commit e2b6e22f298eb986d74d28b8d9906f37f5ff8eb8
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 17:53:05 2012 +0800
Modifications to the handling and docs for auth forms.
commit 98aba856b534620aea9091f824b442b47d2fdb3c
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 15:28:57 2012 +0800
Improved error handling and docs for get_user_model()
commit 0229209c844f06dfeb33b0b8eeec000c127695b6
Merge: 6494bf9 8599f64
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 23 14:50:11 2012 +0800
Merged recent Django trunk changes.
commit 6494bf91f2ddaaabec3ec017f2e3131937c35517
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 17 21:38:44 2012 +0800
Improved validation of swappable model settings.
commit 5a04cde342cc860384eb844cfda5af55204564ad
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Sep 17 07:15:14 2012 +0800
Removed some unused imports.
commit ffd535e4136dc54f084b6ac467e81444696e1c8a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 20:31:28 2012 +0800
Corrected attribute access on for get_by_natural_key
commit 913e1ac84c3d9c7c58a9b3bdbbb15ebccd8a8c0a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 20:12:34 2012 +0800
Added test for proxy model safeguards on swappable models.
commit 280bf19e94d0d534d0e51bae485c1842558f4ff4
Merge: dbb3900 935a863
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 18:16:49 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit dbb3900775a99df8b6cb1d7063cf364eab55621a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 18:09:27 2012 +0800
Fixes for Python 3 compatibility.
commit dfd72131d8664615e245aa0f95b82604ba6b3821
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 15:54:30 2012 +0800
Added protection against proxying swapped models.
commit abcb027190e53613e7f1734e77ee185b2587de31
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 15:11:10 2012 +0800
Cleanup and documentation of AbstractUser base class.
commit a9491a87763e307f0eb0dc246f54ac865a6ffb34
Merge: fd8bb4e 08bcb4a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 14:46:49 2012 +0800
Merge commit '08bcb4aec1ed154cefc631b8510ee13e9af0c19d' into t3011
commit fd8bb4e3e498a92d7a8b340f0684d5f088aa4c92
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 14:20:14 2012 +0800
Documentation improvements coming from community review.
commit b550a6d06d016ab6a0198c4cb2dffe9cceabe8a5
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:52:47 2012 +0800
Refactored skipIfCustomUser into the contrib.auth tests.
commit 52a02f11107c3f0d711742b8ca65b75175b79d6a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:46:10 2012 +0800
Refactored common 'get' pattern into manager method.
commit b441a6bbc7d6065175715cb09316b9f13268171b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 16 13:41:33 2012 +0800
Added note about backwards incompatible change to admin login messages.
commit 08bcb4aec1ed154cefc631b8510ee13e9af0c19d
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date: Sat Sep 15 18:30:33 2012 +0300
Splitted User to AbstractUser and User
commit d9f5e5addbad5e1a01f67e7358e4f5091c3cad81
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date: Sat Sep 15 18:30:02 2012 +0300
Reworked REQUIRED_FIELDS + create_user() interaction
commit 579f152e4a6e06671e1ac1e59e2b43cf4d764bf4
Merge: 9184972 93e6733
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:18:37 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 918497218c58227f5032873ff97261627b2ceab2
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:18:19 2012 +0800
Deprecate AUTH_PROFILE_MODULE and get_profile().
commit 334cdfc1bb6a6794791497cdefda843bca2ea57a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 20:00:12 2012 +0800
Added release notes for new swappable User feature.
commit 5d7bb22e8d913b51aba1c3360e7af8b01b6c0ab6
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 19:59:49 2012 +0800
Ensure swapped models can't be queried.
commit 57ac6e3d32605a67581e875b37ec5b2284711a32
Merge: f2ec915 abfba3b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 15 14:31:54 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit f2ec915b20f81c8afeaa3df25f80689712f720f8
Merge: 1952656 5e99a3d
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 08:29:51 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 19526563b54fa300785c49cfb625c0c6158ced67
Merge: 2c5e833 c4aa26a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 08:22:26 2012 +0800
Merge recent changes from master.
commit 2c5e833a30bef4305d55eacc0703533152f5c427
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 07:53:46 2012 +0800
Corrected admin_views tests following removal of the email fallback on admin logins.
commit 20d1892491839d6ef21f37db4ca136935c2076bf
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sun Sep 9 01:00:37 2012 +0800
Added conditional skips for all tests dependent on the default User model
commit 40ea8b888284775481fc1eaadeff267dbd7e3dfa
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 8 23:47:02 2012 +0800
Added documentation for REQUIRED_FIELDS in custom auth.
commit e6aaf659708cf6491f5485d3edfa616cb9214cc0
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Sat Sep 8 23:20:02 2012 +0800
Added first draft of custom User docs.
Thanks to Greg Turner for the initial text.
commit 75118bd242eec87649da2859e8c50a199a8a1dca
Author: Thomas Sutton <me@thomas-sutton.id.au>
Date: Mon Aug 20 11:17:26 2012 +0800
Admin app should not allow username discovery
The admin app login form should not allow users to discover the username
associated with an email address.
commit d088b3af58dad7449fc58493193a327725c57c22
Author: Thomas Sutton <me@thomas-sutton.id.au>
Date: Mon Aug 20 10:32:13 2012 +0800
Admin app login form should use swapped user model
commit 7e82e83d67ee0871a72e1a3a723afdd214fcefc3
Merge: e29c010 39aa890
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Fri Sep 7 23:45:03 2012 +0800
Merged master changes.
commit e29c010beb96ca07697c4e3e0c0d5d3ffdc4c0a3
Merge: 8e3fd70 30bdf22
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Aug 20 13:12:57 2012 +0800
Merge remote-tracking branch 'django/master' into t3011
commit 8e3fd703d02c31a4c3ac9f51f5011d03c0bd47f6
Merge: 507bb50 26e0ba0
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Aug 20 13:09:09 2012 +0800
Merged recent changes from trunk.
commit 507bb50a9291bfcdcfa1198f9fea21d4e3b1e762
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 20:41:37 2012 +0800
Modified auth app so that login with alternate auth app is possible.
commit dabe3628362ab7a4a6c9686dd874803baa997eaa
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 20:10:51 2012 +0800
Modified auth management commands to handle custom user definitions.
commit 7cc0baf89d490c92ef3f1dc909b8090191a1294b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date: Mon Jun 4 14:17:28 2012 +0800
Added model Meta option for swappable models, and made auth.User a swappable model
2012-09-26 10:48:09 +00:00
|
|
|
|
Email checks on failed admin login
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Prior to Django 1.5, if you attempted to log into the admin interface and
|
|
|
|
|
mistakenly used your email address instead of your username, the admin
|
|
|
|
|
interface would provide a warning advising that your email address was
|
|
|
|
|
not your username. In Django 1.5, the introduction of
|
|
|
|
|
:ref:`custom User models <auth-custom-user>` has required the removal of this
|
|
|
|
|
warning. This doesn't change the login behavior of the admin site; it only
|
|
|
|
|
affects the warning message that is displayed under one particular mode of
|
|
|
|
|
login failure.
|
|
|
|
|
|
2012-07-24 20:24:16 +00:00
|
|
|
|
Changes in tests execution
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
Some changes have been introduced in the execution of tests that might be
|
|
|
|
|
backward-incompatible for some testing setups:
|
|
|
|
|
|
|
|
|
|
Database flushing in ``django.test.TransactionTestCase``
|
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
Previously, the test database was truncated *before* each test run in a
|
|
|
|
|
:class:`~django.test.TransactionTestCase`.
|
|
|
|
|
|
|
|
|
|
In order to be able to run unit tests in any order and to make sure they are
|
|
|
|
|
always isolated from each other, :class:`~django.test.TransactionTestCase` will
|
|
|
|
|
now reset the database *after* each test run instead.
|
|
|
|
|
|
2012-10-25 21:20:55 +00:00
|
|
|
|
No more implicit DB sequences reset
|
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2012-07-24 20:24:16 +00:00
|
|
|
|
|
|
|
|
|
:class:`~django.test.TransactionTestCase` tests used to reset primary key
|
|
|
|
|
sequences automatically together with the database flushing actions described
|
|
|
|
|
above.
|
|
|
|
|
|
|
|
|
|
This has been changed so no sequences are implicitly reset. This can cause
|
|
|
|
|
:class:`~django.test.TransactionTestCase` tests that depend on hard-coded
|
|
|
|
|
primary key values to break.
|
|
|
|
|
|
|
|
|
|
The new :attr:`~django.test.TransactionTestCase.reset_sequences` attribute can
|
|
|
|
|
be used to force the old behavior for :class:`~django.test.TransactionTestCase`
|
|
|
|
|
that might need it.
|
|
|
|
|
|
|
|
|
|
Ordering of tests
|
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
In order to make sure all ``TestCase`` code starts with a clean database,
|
|
|
|
|
tests are now executed in the following order:
|
|
|
|
|
|
|
|
|
|
* First, all unittests (including :class:`unittest.TestCase`,
|
|
|
|
|
:class:`~django.test.SimpleTestCase`, :class:`~django.test.TestCase` and
|
|
|
|
|
:class:`~django.test.TransactionTestCase`) are run with no particular ordering
|
|
|
|
|
guaranteed nor enforced among them.
|
|
|
|
|
|
|
|
|
|
* Then any other tests (e.g. doctests) that may alter the database without
|
|
|
|
|
restoring it to its original state are run.
|
|
|
|
|
|
|
|
|
|
This should not cause any problems unless you have existing doctests which
|
|
|
|
|
assume a :class:`~django.test.TransactionTestCase` executed earlier left some
|
|
|
|
|
database state behind or unit tests that rely on some form of state being
|
|
|
|
|
preserved after the execution of other tests. Such tests are already very
|
|
|
|
|
fragile, and must now be changed to be able to run independently.
|
|
|
|
|
|
2012-08-04 12:17:02 +00:00
|
|
|
|
`cleaned_data` dictionary kept for invalid forms
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
The :attr:`~django.forms.Form.cleaned_data` dictionary is now always present
|
|
|
|
|
after form validation. When the form doesn't validate, it contains only the
|
|
|
|
|
fields that passed validation. You should test the success of the validation
|
|
|
|
|
with the :meth:`~django.forms.Form.is_valid()` method and not with the
|
|
|
|
|
presence or absence of the :attr:`~django.forms.Form.cleaned_data` attribute
|
|
|
|
|
on the form.
|
|
|
|
|
|
2014-12-26 17:34:26 +00:00
|
|
|
|
Behavior of ``syncdb`` with multiple databases
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2012-11-22 19:09:40 +00:00
|
|
|
|
|
2014-12-26 17:34:26 +00:00
|
|
|
|
``syncdb`` now queries the database routers to determine if content
|
2012-11-22 19:09:40 +00:00
|
|
|
|
types (when :mod:`~django.contrib.contenttypes` is enabled) and permissions
|
|
|
|
|
(when :mod:`~django.contrib.auth` is enabled) should be created in the target
|
|
|
|
|
database. Previously, it created them in the default database, even when
|
|
|
|
|
another database was specified with the :djadminopt:`--database` option.
|
|
|
|
|
|
2014-12-26 17:34:26 +00:00
|
|
|
|
If you use ``syncdb`` on multiple databases, you should ensure that
|
2012-11-22 19:09:40 +00:00
|
|
|
|
your routers allow synchronizing content types and permissions to only one of
|
|
|
|
|
them. See the docs on the :ref:`behavior of contrib apps with multiple
|
|
|
|
|
databases <contrib_app_multiple_databases>` for more information.
|
|
|
|
|
|
2013-02-12 23:06:03 +00:00
|
|
|
|
XML deserializer will not parse documents with a DTD
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
In order to prevent exposure to denial-of-service attacks related to external
|
|
|
|
|
entity references and entity expansion, the XML model deserializer now refuses
|
|
|
|
|
to parse XML documents containing a DTD (DOCTYPE definition). Since the XML
|
|
|
|
|
serializer does not output a DTD, this will not impact typical usage, only
|
|
|
|
|
cases where custom-created XML documents are passed to Django's model
|
|
|
|
|
deserializer.
|
|
|
|
|
|
|
|
|
|
Formsets default ``max_num``
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
A (default) value of ``None`` for the ``max_num`` argument to a formset factory
|
|
|
|
|
no longer defaults to allowing any number of forms in the formset. Instead, in
|
|
|
|
|
order to prevent memory-exhaustion attacks, it now defaults to a limit of 1000
|
|
|
|
|
forms. This limit can be raised by explicitly setting a higher value for
|
|
|
|
|
``max_num``.
|
|
|
|
|
|
2012-07-15 19:07:02 +00:00
|
|
|
|
Miscellaneous
|
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
2012-10-03 16:50:12 +00:00
|
|
|
|
* :class:`django.forms.ModelMultipleChoiceField` now returns an empty
|
|
|
|
|
``QuerySet`` as the empty value instead of an empty list.
|
|
|
|
|
|
2012-12-25 14:56:22 +00:00
|
|
|
|
* :func:`~django.utils.http.int_to_base36` properly raises a
|
2014-04-26 14:00:15 +00:00
|
|
|
|
:exc:`TypeError` instead of :exc:`ValueError` for non-integer inputs.
|
2012-08-03 16:46:30 +00:00
|
|
|
|
|
2012-08-18 12:53:22 +00:00
|
|
|
|
* The ``slugify`` template filter is now available as a standard python
|
|
|
|
|
function at :func:`django.utils.text.slugify`. Similarly, ``remove_tags`` is
|
|
|
|
|
available at :func:`django.utils.html.remove_tags`.
|
|
|
|
|
|
2012-09-05 15:05:28 +00:00
|
|
|
|
* Uploaded files are no longer created as executable by default. If you need
|
2012-10-25 21:20:55 +00:00
|
|
|
|
them to be executable change :setting:`FILE_UPLOAD_PERMISSIONS` to your
|
2014-07-26 01:34:13 +00:00
|
|
|
|
needs. The new default value is ``0o666`` (octal) and the current umask value
|
2012-09-05 15:05:28 +00:00
|
|
|
|
is first masked out.
|
|
|
|
|
|
2013-09-06 17:57:25 +00:00
|
|
|
|
* The :class:`F expressions <django.db.models.F>` supported bitwise operators by
|
2012-10-03 15:53:40 +00:00
|
|
|
|
``&`` and ``|``. These operators are now available using ``.bitand()`` and
|
2013-09-06 17:57:25 +00:00
|
|
|
|
``.bitor()`` instead. The removal of ``&`` and ``|`` was done to be
|
|
|
|
|
consistent with :ref:`Q() expressions <complex-lookups-with-q>` and
|
|
|
|
|
``QuerySet`` combining where the operators are used as boolean AND and OR
|
|
|
|
|
operators.
|
2012-10-03 15:53:40 +00:00
|
|
|
|
|
2013-09-06 17:57:25 +00:00
|
|
|
|
* In a ``filter()`` call, when :class:`F expressions <django.db.models.F>`
|
2012-11-22 18:27:28 +00:00
|
|
|
|
contained lookups spanning multi-valued relations, they didn't always reuse
|
|
|
|
|
the same relations as other lookups along the same chain. This was changed,
|
|
|
|
|
and now F() expressions will always use the same relations as other lookups
|
|
|
|
|
within the same ``filter()`` call.
|
|
|
|
|
|
2012-10-13 18:59:58 +00:00
|
|
|
|
* The :ttag:`csrf_token` template tag is no longer enclosed in a div. If you need
|
|
|
|
|
HTML validation against pre-HTML5 Strict DTDs, you should add a div around it
|
|
|
|
|
in your pages.
|
|
|
|
|
|
2012-11-17 21:38:19 +00:00
|
|
|
|
* The template tags library ``adminmedia``, which only contained the
|
|
|
|
|
deprecated template tag ``{% admin_media_prefix %}``, was removed.
|
|
|
|
|
Attempting to load it with ``{% load adminmedia %}`` will fail. If your
|
|
|
|
|
templates still contain that line you must remove it.
|
|
|
|
|
|
2013-02-08 15:32:09 +00:00
|
|
|
|
* Because of an implementation oversight, it was possible to use
|
|
|
|
|
:doc:`django.contrib.redirects </ref/contrib/redirects>` without enabling
|
|
|
|
|
:doc:`django.contrib.sites </ref/contrib/sites>`. This isn't allowed any
|
|
|
|
|
longer. If you're using ``django.contrib.redirects``, make sure
|
2013-02-17 13:33:29 +00:00
|
|
|
|
:setting:`INSTALLED_APPS` contains ``django.contrib.sites``.
|
2013-02-08 15:32:09 +00:00
|
|
|
|
|
2013-04-06 14:04:30 +00:00
|
|
|
|
* :meth:`BoundField.label_tag <django.forms.BoundField.label_tag>` now
|
|
|
|
|
escapes its ``contents`` argument. To avoid the HTML escaping, use
|
|
|
|
|
:func:`django.utils.safestring.mark_safe` on the argument before passing it.
|
|
|
|
|
|
2013-11-18 14:32:25 +00:00
|
|
|
|
* Accessing reverse one-to-one relations fetched via
|
|
|
|
|
:meth:`~django.db.models.query.QuerySet.select_related` now raises
|
2015-05-08 01:30:04 +00:00
|
|
|
|
:exc:`~django.db.models.Model.DoesNotExist` instead of returning ``None``.
|
2013-11-18 14:32:25 +00:00
|
|
|
|
|
2014-02-03 13:09:27 +00:00
|
|
|
|
.. _deprecated-features-1.5:
|
|
|
|
|
|
2012-03-30 09:33:51 +00:00
|
|
|
|
Features deprecated in 1.5
|
|
|
|
|
==========================
|
|
|
|
|
|
2012-12-26 13:19:28 +00:00
|
|
|
|
``django.contrib.localflavor``
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
The localflavor contrib app has been split into separate packages.
|
2015-03-22 11:51:09 +00:00
|
|
|
|
``django.contrib.localflavor`` itself will be removed in Django 1.6,
|
|
|
|
|
after an accelerated deprecation.
|
2012-12-26 13:19:28 +00:00
|
|
|
|
|
2015-03-22 11:51:09 +00:00
|
|
|
|
The new packages are available on Github. The core team cannot
|
|
|
|
|
efficiently maintain these packages in the long term — it spans just a
|
|
|
|
|
dozen countries at this time; similar to translations, maintenance
|
2012-12-26 13:19:28 +00:00
|
|
|
|
will be handed over to interested members of the community.
|
|
|
|
|
|
|
|
|
|
``django.contrib.markup``
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
The markup contrib module has been deprecated and will follow an accelerated
|
|
|
|
|
deprecation schedule. Direct use of python markup libraries or 3rd party tag
|
|
|
|
|
libraries is preferred to Django maintaining this functionality in the
|
|
|
|
|
framework.
|
2012-08-20 19:21:00 +00:00
|
|
|
|
|
2013-06-28 18:13:06 +00:00
|
|
|
|
``AUTH_PROFILE_MODULE``
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
2012-10-23 20:25:38 +00:00
|
|
|
|
|
|
|
|
|
With the introduction of :ref:`custom User models <auth-custom-user>`, there is
|
|
|
|
|
no longer any need for a built-in mechanism to store user profile data.
|
|
|
|
|
|
|
|
|
|
You can still define user profiles models that have a one-to-one relation with
|
|
|
|
|
the User model - in fact, for many applications needing to associate data with
|
|
|
|
|
a User account, this will be an appropriate design pattern to follow. However,
|
2013-06-28 18:13:06 +00:00
|
|
|
|
the ``AUTH_PROFILE_MODULE`` setting, and the
|
|
|
|
|
``django.contrib.auth.models.User.get_profile()`` method for accessing
|
2012-10-23 20:25:38 +00:00
|
|
|
|
the user profile model, should not be used any longer.
|
|
|
|
|
|
2012-12-25 14:56:22 +00:00
|
|
|
|
Streaming behavior of :class:`~django.http.HttpResponse`
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2012-10-23 20:25:38 +00:00
|
|
|
|
|
|
|
|
|
Django 1.5 deprecates the ability to stream a response by passing an iterator
|
|
|
|
|
to :class:`~django.http.HttpResponse`. If you rely on this behavior, switch to
|
2012-10-25 21:20:55 +00:00
|
|
|
|
:class:`~django.http.StreamingHttpResponse`. See
|
|
|
|
|
:ref:`explicit-streaming-responses` above.
|
2012-10-23 20:25:38 +00:00
|
|
|
|
|
|
|
|
|
In Django 1.7 and above, the iterator will be consumed immediately by
|
|
|
|
|
:class:`~django.http.HttpResponse`.
|
|
|
|
|
|
2012-12-26 13:19:28 +00:00
|
|
|
|
.. _simplejson-deprecation:
|
|
|
|
|
|
2012-04-29 17:58:00 +00:00
|
|
|
|
``django.utils.simplejson``
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2012-04-29 18:33:54 +00:00
|
|
|
|
Since Django 1.5 drops support for Python 2.5, we can now rely on the
|
2012-08-20 19:21:00 +00:00
|
|
|
|
:mod:`json` module being available in Python's standard library, so we've
|
2014-10-24 19:35:20 +00:00
|
|
|
|
removed our own copy of ``simplejson``. You should now import :mod:`json`
|
2012-12-25 14:56:22 +00:00
|
|
|
|
instead of ``django.utils.simplejson``.
|
2012-08-20 19:21:00 +00:00
|
|
|
|
|
|
|
|
|
Unfortunately, this change might have unwanted side-effects, because of
|
2014-10-24 19:35:20 +00:00
|
|
|
|
incompatibilities between versions of ``simplejson`` -- see the
|
2012-08-20 19:21:00 +00:00
|
|
|
|
:ref:`backwards-incompatible changes <simplejson-incompatibilities>` section.
|
2014-10-24 19:35:20 +00:00
|
|
|
|
If you rely on features added to ``simplejson`` after it became Python's
|
|
|
|
|
:mod:`json`, you should import ``simplejson`` explicitly.
|
2012-04-29 17:58:00 +00:00
|
|
|
|
|
2012-08-12 12:39:48 +00:00
|
|
|
|
``django.utils.encoding.StrAndUnicode``
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2013-06-29 02:05:00 +00:00
|
|
|
|
The ``django.utils.encoding.StrAndUnicode`` mix-in has been deprecated.
|
2012-08-12 12:39:48 +00:00
|
|
|
|
Define a ``__str__`` method and apply the
|
|
|
|
|
:func:`~django.utils.encoding.python_2_unicode_compatible` decorator instead.
|
2012-06-23 14:57:20 +00:00
|
|
|
|
|
2012-10-23 20:25:38 +00:00
|
|
|
|
``django.utils.itercompat.product``
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2012-12-29 15:35:12 +00:00
|
|
|
|
The ``django.utils.itercompat.product`` function has been deprecated. Use
|
2012-10-23 20:25:38 +00:00
|
|
|
|
the built-in :func:`itertools.product` instead.
|
|
|
|
|
|
2012-10-27 09:49:46 +00:00
|
|
|
|
``cleanup`` management command
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2013-06-28 16:38:04 +00:00
|
|
|
|
The ``cleanup`` management command has been deprecated and replaced by
|
2012-10-27 09:49:46 +00:00
|
|
|
|
:djadmin:`clearsessions`.
|
|
|
|
|
|
|
|
|
|
``daily_cleanup.py`` script
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
The undocumented ``daily_cleanup.py`` script has been deprecated. Use the
|
|
|
|
|
:djadmin:`clearsessions` management command instead.
|
2012-11-02 15:49:29 +00:00
|
|
|
|
|
|
|
|
|
``depth`` keyword argument in ``select_related``
|
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
|
|
The ``depth`` keyword argument in
|
|
|
|
|
:meth:`~django.db.models.query.QuerySet.select_related` has been deprecated.
|
|
|
|
|
You should use field names instead.
|