========================Django 1.5 release notes========================*February 26, 2013*Welcome to Django 1.5!These release notes cover the :ref:`new features <whats-new-1.5>`, as well assome :ref:`backwards incompatible changes <backwards-incompatible-1.5>` you'llwant to be aware of when upgrading from Django 1.4 or older versions. We'vealso dropped some features, which are detailed in :ref:`our deprecation plan<deprecation-removed-in-1.5>`, and we've :ref:`begun the deprecation processfor some features <deprecated-features-1.5>`.Overview========The biggest new feature in Django 1.5 is the `configurable User model`_. BeforeDjango 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 writeyourself. This could be a simple extension to the existing ``User`` model -- forexample, you could add a Twitter or Facebook ID field -- or you could completelyreplace the ``User`` with one totally customized for your site.Django 1.5 is also the first release with `Python 3 support`_! We're labelingthis 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 arewritten back to the database when you call ``save()``. This can helpin high-concurrency operations, and can improve performance.* Better `support for streaming responses <#explicit-streaming-responses>`_ viathe 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-compatiblemanner per :doc:`our API stability policy </misc/api-stability>`.However, as with previous releases, Django 1.5 ships with some minor:ref:`backwards incompatible changes <backwards-incompatible-1.5>`; peopleupgrading 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 interpretedincorrectly (Django considered ``"myview"`` to be a literal name of a view, nota 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 %}`` youcan simply remove that line under Django 1.5Python compatibility====================Django 1.5 requires Python 2.6.5 or above, though we **highly recommend**Python 2.7.3 or above. Support for Python 2.5 and below has been dropped.This change should affect only a small number of Django users, as mostoperating-system vendors today are shipping Python 2.6 or newer as their defaultversion. If you're still using Python 2.5, however, you'll need to stick toDjango 1.4 until you can upgrade your Python version. Per :doc:`our supportpolicy </internals/release-process>`, Django 1.4 will continue to receivesecurity support until the release of Django 1.6.Django 1.5 does not run on a Jython final release, because Jython's latestrelease doesn't currently support Python 2.6. However, Jython currently doesoffer an alpha release featuring 2.7 support, and Django 1.5 supports that alpharelease.Python 3 support----------------Django 1.5 introduces support for Python 3 - specifically, Python3.2 and above. This comes in the form of a **single** codebase; you don'tneed to install a different version of Django on Python 3. This means thatyou can write applications targeted for just Python 2, just Python 3, or singleapplications that support both platforms.However, we're labeling this support "experimental" for now: although it'sreceived extensive testing via our automated test suite, it's received verylittle real-world testing. We've done our best to eliminate bugs, but we can'tbe sure we covered all possible uses of Django.Some features of Django aren't available because they depend on third-partysoftware that hasn't been ported to Python 3 yet, including:- the MySQL database backend (depends on MySQLdb)- :class:`~django.db.models.ImageField` (depends on PIL)- :class:`~django.test.LiveServerTestCase` (depends on Selenium WebDriver)Further, Django's more than a web framework; it's an ecosystem of pluggablecomponents. At this point, very few third-party applications have been portedto Python 3, so it's unlikely that a real-world application will have all itsdependencies satisfied under Python 3.Thus, we're recommending that Django 1.5 not be used in production under Python3. Instead, use this opportunity to begin porting applications to Python 3. Ifyou're an author of a pluggable component, we encourage you to start portingnow.We plan to offer first-class, production-ready support for Python 3 in our nextrelease, Django 1.6... _whats-new-1.5:What's new in Django 1.5========================Configurable User model-----------------------In Django 1.5, you can now use your own model as the store for user-relateddata. If your project needs a username with more than 30 characters, or ifyou 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 cannow 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. Youshould also document any specific features of the User model that yourapplication relies upon.See the :ref:`documentation on custom user models <auth-custom-user>` formore details.Support for saving a subset of model's fields---------------------------------------------The method :meth:`Model.save() <django.db.models.Model.save()>` has a newkeyword argument ``update_fields``. By using this argument it is possible tosave only a select list of model's fields. This can be useful for performancereasons or when trying to avoid overwriting concurrent changes.Deferred instances (those loaded by ``.only()`` or ``.defer()``) willautomatically save just the loaded fields. If any field is set manually afterload, that field will also get updated on save.See the :meth:`Model.save() <django.db.models.Model.save()>` documentation formore details.Caching of related model instances----------------------------------When traversing relations, the ORM will avoid re-fetching objects that werepreviously 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_pollTrueIn Django 1.5, the third line no longer triggers a new SQL query to fetch``first_choice.poll``; it was set by the second line.For one-to-one relationships, both sides can be cached. For many-to-onerelationships, only the single side of the relationship can be cached. Thisis particularly helpful in combination with ``prefetch_related``... _explicit-streaming-responses:Explicit support for streaming responses----------------------------------------Before Django 1.5, it was possible to create a streaming response by passingan 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 whichis an iterator.Since :class:`~django.http.StreamingHttpResponse` does not have a ``content``attribute, middleware that needs access to the response content must test forstreaming responses and behave accordingly.``{% verbatim %}`` template tag-------------------------------To make it easier to deal with JavaScript templates which collide with Django'ssyntax, you can now use the :ttag:`verbatim` block tag to avoid parsing thetag's content.Retrieval of ``ContentType`` instances associated with proxy models-------------------------------------------------------------------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``.By passing ``False`` using this argument it is now possible to retrieve the:class:`ContentType <django.contrib.contenttypes.models.ContentType>`associated with proxy models.New ``view`` variable in class-based views context--------------------------------------------------In all :doc:`generic class-based views </topics/class-based-views/index>`(or any class-based view inheriting from ``ContextMixin``), the context dictionarycontains a ``view`` variable that points to the ``View`` instance.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).* The ``wkb`` and ``hex`` properties of:class:`~django.contrib.gis.geos.GEOSGeometry` objects preserve the Zdimension.* Support for PostGIS 2.0 has been added and support for GDAL < 1.5 has beendropped.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>`.Minor features--------------Django 1.5 also includes several smaller improvements worth noting:* The template engine now interprets ``True``, ``False`` and ``None`` as thecorresponding Python objects.* :mod:`django.utils.timezone` provides a helper for converting awaredatetimes between time zones. See :func:`~django.utils.timezone.localtime`.* The generic views support OPTIONS requests.* Management commands do not raise ``SystemExit`` any more when called by codefrom :func:`~django.core.management.call_command`. Any exception raised bythe command (mostly :exc:`~django.core.management.CommandError`) ispropagated.Moreover, when you output errors or messages in your custom commands, youshould now use ``self.stdout.write('message')`` and``self.stderr.write('error')`` (see the note on:ref:`management commands output <management-commands-output>`).* The :djadmin:`dumpdata` management command outputs one row at a time,preventing out-of-memory errors when dumping large datasets.* In the localflavor for Canada, ``pq`` was added to the acceptable codes forQuebec. It's an old abbreviation.* The :ref:`receiver <connecting-receiver-functions>` decorator is now able toconnect to more than one signal by supplying a list of signals.* In the admin, you can now filter users by groups which they are members of.* :meth:`QuerySet.bulk_create()<django.db.models.query.QuerySet.bulk_create>` now has a batch_sizeargument. By default the batch_size is unlimited except for SQLite wheresingle batch is limited so that 999 parameters per query isn't exceeded.* The :setting:`LOGIN_URL` and :setting:`LOGIN_REDIRECT_URL` settings now alsoaccept view function names and:ref:`named URL patterns <naming-url-patterns>`. This allows you to reduceconfiguration duplication. More information can be found in the:func:`~django.contrib.auth.decorators.login_required` documentation.* Django now provides a mod_wsgi :doc:`auth handler</howto/deployment/wsgi/apache-auth>`.* The :meth:`QuerySet.delete() <django.db.models.query.QuerySet.delete>`and :meth:`Model.delete() <django.db.models.Model.delete()>` can now takefast-path in some cases. The fast-path allows for less queries and lessobjects fetched into memory. See :meth:`QuerySet.delete()<django.db.models.query.QuerySet.delete>` for details.* An instance of ``ResolverMatch`` is stored on the request as``resolver_match``.* By default, all logging messages reaching the ``django`` logger when:setting:`DEBUG` is ``True`` are sent to the console (unless you redefine thelogger in your :setting:`LOGGING` setting).* When using :class:`~django.template.RequestContext`, it is now possible tolook up permissions by using ``{% if 'someapp.someperm' in perms %}``in templates.* It's not required any more to have ``404.html`` and ``500.html`` templates inthe root templates directory. Django will output some basic error messages forboth situations when those templates are not found. It's still recommended asgood practice to provide those templates in order to present pretty errorpages to the user.* :mod:`django.contrib.auth` provides a new signal that is emittedwhenever a user fails to login successfully. See:data:`~django.contrib.auth.signals.user_login_failed`* The new :option:`loaddata --ignorenonexistent` option ignore data for fieldsthat no longer exist.* :meth:`~django.test.SimpleTestCase.assertXMLEqual` and:meth:`~django.test.SimpleTestCase.assertXMLNotEqual` new assertions allowyou to test equality for XML content at a semantic level, without caring forsyntax differences (spaces, attribute order, etc.).* RemoteUserMiddleware now forces logout when the REMOTE_USER headerdisappears during the same browser session.* The :ref:`cache-based session backend <cached-sessions-backend>` can storesession data in a non-default cache.* Multi-column indexes can now be created on models. Read the:attr:`~django.db.models.Options.index_together` documentation for moreinformation.* During Django's logging configuration verbose Deprecation warnings areenabled and warnings are captured into the logging system. Logged warningsare routed through the ``console`` logging handler, which by default requires:setting:`DEBUG` to be True for output to be generated. The result is thatDeprecationWarnings should be printed to the console in developmentenvironments the way they have been in Python versions < 2.7.* The API for :meth:`django.contrib.admin.ModelAdmin.message_user` method hasbeen modified to accept additional arguments adding capabilities similar to:func:`django.contrib.messages.add_message`. This is useful for generatingerror messages from admin actions.* The admin's list filters can now be customized per-request thanks to the new:meth:`django.contrib.admin.ModelAdmin.get_list_filter` method... _backwards-incompatible-1.5:Backwards incompatible changes in 1.5=====================================.. warning::In addition to the changes outlined in this section, be sure to review the:ref:`deprecation plan <deprecation-removed-in-1.5>` for any features thathave been removed. If you haven't updated your code within thedeprecation timeline for a given feature, its removal may appear as abackwards incompatible change.``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 nowrequired 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.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 abstractmodel 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 soonas 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 usingthe abstract class, you should migrate that logic to a Python``staticmethod`` or ``classmethod`` on the abstract class.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`` inthe context as a :class:`datetime.date` rather than a string. If you areusing ``{{ year }}`` in your templates, you must replace it with ``{{year|date:"Y" }}``.``next_year`` and ``previous_year`` were also added in the context. They arecalculated according to ``allow_empty`` and ``allow_future``.Context in year and month archive class-based views---------------------------------------------------:class:`~django.views.generic.dates.YearArchiveView` and:class:`~django.views.generic.dates.MonthArchiveView` were documented toprovide a ``date_list`` sorted in ascending order in the context, like theirfunction-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.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 URLconfdirectly into the context.Non-form data in HTTP requests------------------------------:attr:`request.POST <django.http.HttpRequest.POST>` will no longer include dataposted via HTTP requests with non form-specific content-types in the header.In prior versions, data posted with content-types other than:mimetype:`multipart/form-data` or:mimetype:`application/x-www-form-urlencoded` would still end up represented inthe :attr:`request.POST <django.http.HttpRequest.POST>` attribute. Developerswishing to access the raw POST data for these cases, should use the:attr:`request.body <django.http.HttpRequest.body>` attribute instead.:data:`~django.core.signals.request_finished` signal----------------------------------------------------Django used to send the :data:`~django.core.signals.request_finished` signalas soon as the view function returned a response. This interacted badly with:ref:`streaming responses <httpresponse-streaming>` that delay contentgeneration.This signal is now sent after the content is fully consumed by the WSGIgateway. This might be backwards incompatible if you rely on the signal beingfired before sending the response content to the client. If you do, you shouldconsider using :doc:`middleware </topics/http/middleware>` instead... note::Some WSGI servers and middleware do not always call ``close`` on theresponse object after handling a request, most notably uWSGI prior to 1.2.6and 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 idleconnections to database and memcache servers.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 asJSON or XML. Since such requests may contain arbitrary data, Django doesn'tattempt to decode their body.However, the test client used to build a query string for OPTIONS and DELETErequests like for GET, and a request body for PUT requests like for POST. Thisencoding was arbitrary and inconsistent with Django's behavior when itreceives 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 testclient and set the ``content_type`` argument... _simplejson-incompatibilities:System version of ``simplejson`` no longer used-----------------------------------------------:ref:`As explained below <simplejson-deprecation>`, Django 1.5 deprecates``django.utils.simplejson`` in favor of Python 2.6's built-in :mod:`json`module. In theory, this change is harmless. Unfortunately, because ofincompatibilities between versions of ``simplejson``, it may trigger errorsin some circumstances.JSON-related features in Django 1.4 always used ``django.utils.simplejson``.This module was actually:- A system version of ``simplejson``, if one was available (i.e. ``importsimplejson`` works), if it was more recent than Django's built-in copy or ithad the C speedups, or- The :mod:`json` module from the standard library, if it was available (i.e.Python 2.6 or greater), or- A built-in copy of version 2.0.7 of ``simplejson``.In Django 1.5, those features use Python's :mod:`json` module, which is basedon version 2.0.9 of ``simplejson``.There are no known incompatibilities between Django's copy of version 2.0.7 andPython's copy of version 2.0.9. However, there are some incompatibilitiesbetween other versions of ``simplejson``:- While the ``simplejson`` API is documented as always returning Unicodestrings, the optional C implementation can return a bytestring. This wasfixed in Python 2.7.- ``simplejson.JSONEncoder`` gained a ``namedtuple_as_object`` keywordargument in version 2.2.More information on these incompatibilities is available in:ticket:`ticket #18023 <18023#comment:10>`.The net result is that, if you have installed ``simplejson`` and your codeuses Django's serialization internals directly -- for instance``django.core.serializers.json.DjangoJSONEncoder``, the switch from``simplejson`` to :mod:`json` could break your code. (In general, changes tointernals aren't documented; we're making an exception here.)At this point, the maintainers of Django believe that using :mod:`json` fromthe standard library offers the strongest guarantee of backwards-compatibility.They recommend to use it from now on.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 acceptUnicode parameters (``password``, ``salt`` or ``encoded``). If any of thehashing methods need bytestrings, you can use the:func:`~django.utils.encoding.force_bytes` utility to encode the strings.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 returnednumber was inside the existing page range.It does check it now and raises an :exc:`~django.core.paginator.InvalidPage`exception when the number is either too low or too high.Behavior of autocommit database option on PostgreSQL changed------------------------------------------------------------PostgreSQL's autocommit option didn't work as advertised previously. It didwork for single transaction block, but after the first block was left theautocommit behavior was never restored. This bug is now fixed in 1.5. Whilethis is only a bug fix, it is worth checking your applications behavior ifyou are using PostgreSQL together with the autocommit option.Session not saved on 500 responses----------------------------------Django's session middleware will skip saving the session data if theresponse's status code is 500.Email checks on failed admin login----------------------------------Prior to Django 1.5, if you attempted to log into the admin interface andmistakenly used your email address instead of your username, the admininterface would provide a warning advising that your email address wasnot your username. In Django 1.5, the introduction of:ref:`custom user models <auth-custom-user>` has required the removal of thiswarning. This doesn't change the login behavior of the admin site; it onlyaffects the warning message that is displayed under one particular mode oflogin failure.Changes in tests execution--------------------------Some changes have been introduced in the execution of tests that might bebackward-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 arealways isolated from each other, :class:`~django.test.TransactionTestCase` willnow reset the database *after* each test run instead.No more implicit DB sequences reset~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~:class:`~django.test.TransactionTestCase` tests used to reset primary keysequences automatically together with the database flushing actions describedabove.This has been changed so no sequences are implicitly reset. This can cause:class:`~django.test.TransactionTestCase` tests that depend on hard-codedprimary key values to break.The new :attr:`~django.test.TransactionTestCase.reset_sequences` attribute canbe 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 unit tests (including :class:`unittest.TestCase`,:class:`~django.test.SimpleTestCase`, :class:`~django.test.TestCase` and:class:`~django.test.TransactionTestCase`) are run with no particular orderingguaranteed nor enforced among them.* Then any other tests (e.g. doctests) that may alter the database withoutrestoring it to its original state are run.This should not cause any problems unless you have existing doctests whichassume a :class:`~django.test.TransactionTestCase` executed earlier left somedatabase state behind or unit tests that rely on some form of state beingpreserved after the execution of other tests. Such tests are already veryfragile, and must now be changed to be able to run independently.``cleaned_data`` dictionary kept for invalid forms--------------------------------------------------The :attr:`~django.forms.Form.cleaned_data` dictionary is now always presentafter form validation. When the form doesn't validate, it contains only thefields that passed validation. You should test the success of the validationwith the :meth:`~django.forms.Form.is_valid()` method and not with thepresence or absence of the :attr:`~django.forms.Form.cleaned_data` attributeon the form.Behavior of ``syncdb`` with multiple databases----------------------------------------------``syncdb`` now queries the database routers to determine if contenttypes (when :mod:`~django.contrib.contenttypes` is enabled) and permissions(when :mod:`~django.contrib.auth` is enabled) should be created in the targetdatabase. Previously, it created them in the default database, even whenanother database was specified with the ``--database`` option.If you use ``syncdb`` on multiple databases, you should ensure thatyour routers allow synchronizing content types and permissions to only one ofthem. See the docs on the :ref:`behavior of contrib apps with multipledatabases <contrib_app_multiple_databases>` for more information.XML deserializer will not parse documents with a DTD----------------------------------------------------In order to prevent exposure to denial-of-service attacks related to externalentity references and entity expansion, the XML model deserializer now refusesto parse XML documents containing a DTD (DOCTYPE definition). Since the XMLserializer does not output a DTD, this will not impact typical usage, onlycases where custom-created XML documents are passed to Django's modeldeserializer.Formsets default ``max_num``----------------------------A (default) value of ``None`` for the ``max_num`` argument to a formset factoryno longer defaults to allowing any number of forms in the formset. Instead, inorder to prevent memory-exhaustion attacks, it now defaults to a limit of 1000forms. This limit can be raised by explicitly setting a higher value for``max_num``.Miscellaneous-------------* :class:`django.forms.ModelMultipleChoiceField` now returns an empty``QuerySet`` as the empty value instead of an empty list.* :func:`~django.utils.http.int_to_base36` properly raises a:exc:`TypeError` instead of :exc:`ValueError` for non-integer inputs.* The ``slugify`` template filter is now available as a standard Pythonfunction at :func:`django.utils.text.slugify`. Similarly, ``remove_tags`` isavailable at ``django.utils.html.remove_tags()``.* Uploaded files are no longer created as executable by default. If you needthem to be executable change :setting:`FILE_UPLOAD_PERMISSIONS` to yourneeds. The new default value is ``0o666`` (octal) and the current umask valueis first masked out.* The :class:`F expressions <django.db.models.F>` supported bitwise operators by``&`` and ``|``. These operators are now available using ``.bitand()`` and``.bitor()`` instead. The removal of ``&`` and ``|`` was done to beconsistent with :ref:`Q() expressions <complex-lookups-with-q>` and``QuerySet`` combining where the operators are used as boolean AND and ORoperators.* In a ``filter()`` call, when :class:`F expressions <django.db.models.F>`contained lookups spanning multi-valued relations, they didn't always reusethe same relations as other lookups along the same chain. This was changed,and now F() expressions will always use the same relations as other lookupswithin the same ``filter()`` call.* The :ttag:`csrf_token` template tag is no longer enclosed in a div. If you needHTML validation against pre-HTML5 Strict DTDs, you should add a div around itin your pages.* The template tags library ``adminmedia``, which only contained thedeprecated template tag ``{% admin_media_prefix %}``, was removed.Attempting to load it with ``{% load adminmedia %}`` will fail. If yourtemplates still contain that line you must remove it.* 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 anylonger. If you're using ``django.contrib.redirects``, make sure:setting:`INSTALLED_APPS` contains ``django.contrib.sites``.* :meth:`BoundField.label_tag <django.forms.BoundField.label_tag>` nowescapes its ``contents`` argument. To avoid the HTML escaping, use:func:`django.utils.safestring.mark_safe` on the argument before passing it.* Accessing reverse one-to-one relations fetched via:meth:`~django.db.models.query.QuerySet.select_related` now raises:exc:`~django.db.models.Model.DoesNotExist` instead of returning ``None``... _deprecated-features-1.5:Features deprecated in 1.5==========================``django.contrib.localflavor``------------------------------The localflavor contrib app has been split into separate packages.``django.contrib.localflavor`` itself will be removed in Django 1.6,after an accelerated deprecation.The new packages are available on GitHub. The core team cannotefficiently maintain these packages in the long term — it spans just adozen countries at this time; similar to translations, maintenancewill be handed over to interested members of the community.``django.contrib.markup``-------------------------The markup contrib module has been deprecated and will follow an accelerateddeprecation schedule. Direct use of Python markup libraries or 3rd party taglibraries is preferred to Django maintaining this functionality in theframework.``AUTH_PROFILE_MODULE``-----------------------With the introduction of :ref:`custom user models <auth-custom-user>`, there isno 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 withthe User model - in fact, for many applications needing to associate data witha User account, this will be an appropriate design pattern to follow. However,the ``AUTH_PROFILE_MODULE`` setting, and the``django.contrib.auth.models.User.get_profile()`` method for accessingthe user profile model, should not be used any longer.Streaming behavior of :class:`~django.http.HttpResponse`--------------------------------------------------------Django 1.5 deprecates the ability to stream a response by passing an iteratorto :class:`~django.http.HttpResponse`. If you rely on this behavior, switch to:class:`~django.http.StreamingHttpResponse`. See:ref:`explicit-streaming-responses` above.In Django 1.7 and above, the iterator will be consumed immediately by:class:`~django.http.HttpResponse`... _simplejson-deprecation:``django.utils.simplejson``---------------------------Since Django 1.5 drops support for Python 2.5, we can now rely on the:mod:`json` module being available in Python's standard library, so we'veremoved our own copy of ``simplejson``. You should now import :mod:`json`instead of ``django.utils.simplejson``.Unfortunately, this change might have unwanted side-effects, because ofincompatibilities between versions of ``simplejson`` -- see the:ref:`backwards-incompatible changes <simplejson-incompatibilities>` section.If you rely on features added to ``simplejson`` after it became Python's:mod:`json`, you should import ``simplejson`` explicitly.``django.utils.encoding.StrAndUnicode``---------------------------------------The ``django.utils.encoding.StrAndUnicode`` mix-in has been deprecated.Define a ``__str__`` method and apply the``django.utils.encoding.python_2_unicode_compatible`` decorator instead.``django.utils.itercompat.product``-----------------------------------The ``django.utils.itercompat.product`` function has been deprecated. Usethe built-in :func:`itertools.product` instead.``cleanup`` management command------------------------------The ``cleanup`` management command has been deprecated and replaced by:djadmin:`clearsessions`.``daily_cleanup.py`` script---------------------------The undocumented ``daily_cleanup.py`` script has been deprecated. Use the:djadmin:`clearsessions` management command instead.``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.