1.4-alpha-1.txt 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126
  1. ==============================
  2. Django 1.4 alpha release notes
  3. ==============================
  4. December 22, 2011.
  5. Welcome to Django 1.4 alpha!
  6. This is the first in a series of preview/development releases leading up to
  7. the eventual release of Django 1.4, scheduled for March 2012. This release is
  8. primarily targeted at developers who are interested in trying out new features
  9. and testing the Django codebase to help identify and resolve bugs prior to the
  10. final 1.4 release.
  11. As such, this release is *not* intended for production use, and any such use
  12. is discouraged.
  13. Django 1.4 alpha includes various `new features`_ and some minor `backwards
  14. incompatible changes`_. There are also some features that have been dropped,
  15. which are detailed in :doc:`our deprecation plan </internals/deprecation>`,
  16. and we've `begun the deprecation process for some features`_.
  17. .. _new features: `What's new in Django 1.4`_
  18. .. _backwards incompatible changes: `Backwards incompatible changes in 1.4`_
  19. .. _begun the deprecation process for some features: `Features deprecated in 1.4`_
  20. Python compatibility
  21. ====================
  22. While not a new feature, it's important to note that Django 1.4 introduces the
  23. second shift in our Python compatibility policy since Django's initial public
  24. debut. Django 1.2 dropped support for Python 2.3; now Django 1.4 drops support
  25. for Python 2.4. As such, the minimum Python version required for Django is now
  26. 2.5, and Django is tested and supported on Python 2.5, 2.6 and 2.7.
  27. This change should affect only a small number of Django users, as most
  28. operating-system vendors today are shipping Python 2.5 or newer as their default
  29. version. If you're still using Python 2.4, however, you'll need to stick to
  30. Django 1.3 until you can upgrade; per :doc:`our support policy
  31. </internals/release-process>`, Django 1.3 will continue to receive security
  32. support until the release of Django 1.5.
  33. Django does not support Python 3.x at this time. A document outlining our full
  34. timeline for deprecating Python 2.x and moving to Python 3.x will be published
  35. before the release of Django 1.4.
  36. What's new in Django 1.4
  37. ========================
  38. Support for in-browser testing frameworks
  39. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  40. Django 1.4 now supports integration with in-browser testing frameworks such
  41. as Selenium_ or Windmill_ thanks to the :class:`django.test.LiveServerTestCase`
  42. base class, allowing you to test the interactions between your site's front and
  43. back ends more comprehensively. See the
  44. :class:`documentation<django.test.LiveServerTestCase>` for more details and
  45. concrete examples.
  46. .. _Windmill: http://www.getwindmill.com/
  47. .. _Selenium: http://seleniumhq.org/
  48. ``SELECT FOR UPDATE`` support
  49. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  50. Django 1.4 now includes a :meth:`QuerySet.select_for_update()
  51. <django.db.models.query.QuerySet.select_for_update>` method which generates a
  52. ``SELECT ... FOR UPDATE`` SQL query. This will lock rows until the end of the
  53. transaction, meaning that other transactions cannot modify or delete rows
  54. matched by a ``FOR UPDATE`` query.
  55. For more details, see the documentation for
  56. :meth:`~django.db.models.query.QuerySet.select_for_update`.
  57. ``Model.objects.bulk_create`` in the ORM
  58. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  59. This method allows for more efficient creation of multiple objects in the ORM.
  60. It can provide significant performance increases if you have many objects.
  61. Django makes use of this internally, meaning some operations (such as database
  62. setup for test suites) have seen a performance benefit as a result.
  63. See the :meth:`~django.db.models.query.QuerySet.bulk_create` docs for more
  64. information.
  65. ``QuerySet.prefetch_related``
  66. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. Similar to :meth:`~django.db.models.query.QuerySet.select_related` but with a
  68. different strategy and broader scope,
  69. :meth:`~django.db.models.query.QuerySet.prefetch_related` has been added to
  70. :class:`~django.db.models.query.QuerySet`. This method returns a new
  71. ``QuerySet`` that will prefetch each of the specified related lookups in a
  72. single batch as soon as the query begins to be evaluated. Unlike
  73. ``select_related``, it does the joins in Python, not in the database, and
  74. supports many-to-many relationships,
  75. :class:`~django.contrib.contenttypes.generic.GenericForeignKey` and more. This
  76. allows you to fix a very common performance problem in which your code ends up
  77. doing O(n) database queries (or worse) if objects on your primary ``QuerySet``
  78. each have many related objects that you also need.
  79. Improved password hashing
  80. ~~~~~~~~~~~~~~~~~~~~~~~~~
  81. Django's auth system (``django.contrib.auth``) stores passwords using a one-way
  82. algorithm. Django 1.3 uses the SHA1_ algorithm, but increasing processor speeds
  83. and theoretical attacks have revealed that SHA1 isn't as secure as we'd like.
  84. Thus, Django 1.4 introduces a new password storage system: by default Django now
  85. uses the PBKDF2_ algorithm (as recommended by NIST_). You can also easily choose
  86. a different algorithm (including the popular bcrypt_ algorithm). For more
  87. details, see :ref:`auth_password_storage`.
  88. .. _sha1: http://en.wikipedia.org/wiki/SHA1
  89. .. _pbkdf2: http://en.wikipedia.org/wiki/PBKDF2
  90. .. _nist: http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf
  91. .. _bcrypt: http://en.wikipedia.org/wiki/Bcrypt
  92. HTML5 Doctype
  93. ~~~~~~~~~~~~~
  94. We've switched the admin and other bundled templates to use the HTML5
  95. doctype. While Django will be careful to maintain compatibility with older
  96. browsers, this change means that you can use any HTML5 features you need in
  97. admin pages without having to lose HTML validity or override the provided
  98. templates to change the doctype.
  99. List filters in admin interface
  100. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101. Prior to Django 1.4, the :mod:`~django.contrib.admin` app allowed you to specify
  102. change list filters by specifying a field lookup, but didn't allow you to create
  103. custom filters. This has been rectified with a simple API (previously used
  104. internally and known as "FilterSpec"). For more details, see the documentation
  105. for :attr:`~django.contrib.admin.ModelAdmin.list_filter`.
  106. Multiple sort in admin interface
  107. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108. The admin change list now supports sorting on multiple columns. It respects all
  109. elements of the :attr:`~django.contrib.admin.ModelAdmin.ordering` attribute, and
  110. sorting on multiple columns by clicking on headers is designed to mimic the
  111. behavior of desktop GUIs. The
  112. :meth:`~django.contrib.admin.ModelAdmin.get_ordering` method for specifying the
  113. ordering dynamically (e.g. depending on the request) has also been added.
  114. New ``ModelAdmin`` methods
  115. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  116. A new :meth:`~django.contrib.admin.ModelAdmin.save_related` method was added to
  117. :mod:`~django.contrib.admin.ModelAdmin` to ease customization of how
  118. related objects are saved in the admin.
  119. Two other new methods,
  120. :meth:`~django.contrib.admin.ModelAdmin.get_list_display` and
  121. :meth:`~django.contrib.admin.ModelAdmin.get_list_display_links`
  122. were added to :class:`~django.contrib.admin.ModelAdmin` to enable the dynamic
  123. customization of fields and links displayed on the admin change list.
  124. Admin inlines respect user permissions
  125. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126. Admin inlines will now only allow those actions for which the user has
  127. permission. For ``ManyToMany`` relationships with an auto-created intermediate
  128. model (which does not have its own permissions), the change permission for the
  129. related model determines if the user has the permission to add, change or
  130. delete relationships.
  131. Tools for cryptographic signing
  132. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  133. Django 1.4 adds both a low-level API for signing values and a high-level API
  134. for setting and reading signed cookies, one of the most common uses of
  135. signing in Web applications.
  136. See the :doc:`cryptographic signing </topics/signing>` docs for more
  137. information.
  138. Cookie-based session backend
  139. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  140. Django 1.4 introduces a new cookie-based backend for the session framework
  141. which uses the tools for :doc:`cryptographic signing </topics/signing>` to
  142. store the session data in the client's browser.
  143. See the :ref:`cookie-based session backend <cookie-session-backend>` docs for
  144. more information.
  145. New form wizard
  146. ~~~~~~~~~~~~~~~
  147. The previous ``FormWizard`` from the formtools contrib app has been
  148. replaced with a new implementation based on the class-based views
  149. introduced in Django 1.3. It features a pluggable storage API and doesn't
  150. require the wizard to pass around hidden fields for every previous step.
  151. Django 1.4 ships with a session-based storage backend and a cookie-based
  152. storage backend. The latter uses the tools for
  153. :doc:`cryptographic signing </topics/signing>` also introduced in
  154. Django 1.4 to store the wizard's state in the user's cookies.
  155. See the :doc:`form wizard </ref/contrib/formtools/form-wizard>` docs for
  156. more information.
  157. ``reverse_lazy``
  158. ~~~~~~~~~~~~~~~~
  159. A lazily evaluated version of :func:`django.core.urlresolvers.reverse` was
  160. added to allow using URL reversals before the project's URLConf gets loaded.
  161. Translating URL patterns
  162. ~~~~~~~~~~~~~~~~~~~~~~~~
  163. Django 1.4 gained the ability to look for a language prefix in the URL pattern
  164. when using the new :func:`~django.conf.urls.i18n.i18n_patterns` helper function.
  165. Additionally, it's now possible to define translatable URL patterns using
  166. :func:`~django.utils.translation.ugettext_lazy`. See
  167. :ref:`url-internationalization` for more information about the language prefix
  168. and how to internationalize URL patterns.
  169. Contextual translation support for ``{% trans %}`` and ``{% blocktrans %}``
  170. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  171. The :ref:`contextual translation<contextual-markers>` support introduced in
  172. Django 1.3 via the ``pgettext`` function has been extended to the
  173. :ttag:`trans` and :ttag:`blocktrans` template tags using the new ``context``
  174. keyword.
  175. Customizable ``SingleObjectMixin`` URLConf kwargs
  176. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  177. Two new attributes,
  178. :attr:`pk_url_kwarg<django.views.generic.detail.SingleObjectMixin.pk_url_kwarg>`
  179. and
  180. :attr:`slug_url_kwarg<django.views.generic.detail.SingleObjectMixin.slug_url_kwarg>`,
  181. have been added to :class:`~django.views.generic.detail.SingleObjectMixin` to
  182. enable the customization of URLConf keyword arguments used for single
  183. object generic views.
  184. Assignment template tags
  185. ~~~~~~~~~~~~~~~~~~~~~~~~
  186. A new :ref:`assignment_tag<howto-custom-template-tags-assignment-tags>` helper
  187. function was added to ``template.Library`` to ease the creation of template
  188. tags that store data in a specified context variable.
  189. ``*args`` and ``**kwargs`` support for template tag helper functions
  190. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  191. The :ref:`simple_tag<howto-custom-template-tags-simple-tags>`,
  192. :ref:`inclusion_tag <howto-custom-template-tags-inclusion-tags>` and
  193. newly introduced
  194. :ref:`assignment_tag<howto-custom-template-tags-assignment-tags>` template
  195. helper functions may now accept any number of positional or keyword arguments.
  196. For example:
  197. .. code-block:: python
  198. @register.simple_tag
  199. def my_tag(a, b, *args, **kwargs):
  200. warning = kwargs['warning']
  201. profile = kwargs['profile']
  202. ...
  203. return ...
  204. Then in the template any number of arguments may be passed to the template tag.
  205. For example:
  206. .. code-block:: html+django
  207. {% my_tag 123 "abcd" book.title warning=message|lower profile=user.profile %}
  208. No wrapping of exceptions in ``TEMPLATE_DEBUG`` mode
  209. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  210. In previous versions of Django, whenever the :setting:`TEMPLATE_DEBUG` setting
  211. was ``True``, any exception raised during template rendering (even exceptions
  212. unrelated to template syntax) were wrapped in ``TemplateSyntaxError`` and
  213. re-raised. This was done in order to provide detailed template source location
  214. information in the debug 500 page.
  215. In Django 1.4, exceptions are no longer wrapped. Instead, the original
  216. exception is annotated with the source information. This means that catching
  217. exceptions from template rendering is now consistent regardless of the value of
  218. :setting:`TEMPLATE_DEBUG`, and there's no need to catch and unwrap
  219. ``TemplateSyntaxError`` in order to catch other errors.
  220. ``truncatechars`` template filter
  221. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  222. Added a filter which truncates a string to be no longer than the specified
  223. number of characters. Truncated strings end with a translatable ellipsis
  224. sequence ("..."). See the documentation for :tfilter:`truncatechars` for
  225. more details.
  226. ``static`` template tag
  227. ~~~~~~~~~~~~~~~~~~~~~~~
  228. The :mod:`staticfiles<django.contrib.staticfiles>` contrib app has a new
  229. :ttag:`static<staticfiles-static>` template tag to refer to files saved with
  230. the :setting:`STATICFILES_STORAGE` storage backend. It uses the storage
  231. backend's ``url`` method and therefore supports advanced features such as
  232. :ref:`serving files from a cloud service<staticfiles-from-cdn>`.
  233. ``CachedStaticFilesStorage`` storage backend
  234. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  235. In addition to the `static template tag`_, the
  236. :mod:`staticfiles<django.contrib.staticfiles>` contrib app now has a
  237. :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage` backend
  238. which caches the files it saves (when running the :djadmin:`collectstatic`
  239. management command) by appending the MD5 hash of the file's content to the
  240. filename. For example, the file ``css/styles.css`` would also be saved as
  241. ``css/styles.55e7cbb9ba48.css``
  242. See the :class:`~django.contrib.staticfiles.storage.CachedStaticFilesStorage`
  243. docs for more information.
  244. Simple clickjacking protection
  245. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  246. We've added a middleware to provide easy protection against `clickjacking
  247. <http://en.wikipedia.org/wiki/Clickjacking>`_ using the ``X-Frame-Options``
  248. header. It's not enabled by default for backwards compatibility reasons, but
  249. you'll almost certainly want to :doc:`enable it </ref/clickjacking/>` to help
  250. plug that security hole for browsers that support the header.
  251. CSRF improvements
  252. ~~~~~~~~~~~~~~~~~
  253. We've made various improvements to our CSRF features, including the
  254. :func:`~django.views.decorators.csrf.ensure_csrf_cookie` decorator which can
  255. help with AJAX heavy sites, protection for PUT and DELETE requests, and the
  256. :setting:`CSRF_COOKIE_SECURE` and :setting:`CSRF_COOKIE_PATH` settings which can
  257. improve the security and usefulness of the CSRF protection. See the :doc:`CSRF
  258. docs </ref/contrib/csrf>` for more information.
  259. Error report filtering
  260. ~~~~~~~~~~~~~~~~~~~~~~
  261. Two new function decorators, :func:`sensitive_variables` and
  262. :func:`sensitive_post_parameters`, were added to allow designating the
  263. local variables and POST parameters which may contain sensitive
  264. information and should be filtered out of error reports.
  265. All POST parameters are now systematically filtered out of error reports for
  266. certain views (``login``, ``password_reset_confirm``, ``password_change``, and
  267. ``add_view`` in :mod:`django.contrib.auth.views`, as well as
  268. ``user_change_password`` in the admin app) to prevent the leaking of sensitive
  269. information such as user passwords.
  270. You may override or customize the default filtering by writing a :ref:`custom
  271. filter<custom-error-reports>`. For more information see the docs on
  272. :ref:`Filtering error reports<filtering-error-reports>`.
  273. Extended IPv6 support
  274. ~~~~~~~~~~~~~~~~~~~~~
  275. The previously added support for IPv6 addresses when using the runserver
  276. management command in Django 1.3 has now been further extended by adding
  277. a :class:`~django.db.models.fields.GenericIPAddressField` model field,
  278. a :class:`~django.forms.fields.GenericIPAddressField` form field and
  279. the validators :data:`~django.core.validators.validate_ipv46_address` and
  280. :data:`~django.core.validators.validate_ipv6_address`
  281. Updated default project layout and ``manage.py``
  282. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283. Django 1.4 ships with an updated default project layout and ``manage.py`` file
  284. for the :djadmin:`startproject` management command. These fix some issues with
  285. the previous ``manage.py`` handling of Python import paths that caused double
  286. imports, trouble moving from development to deployment, and other
  287. difficult-to-debug path issues.
  288. The previous ``manage.py`` called functions that are now deprecated, and thus
  289. projects upgrading to Django 1.4 should update their ``manage.py``. (The
  290. old-style ``manage.py`` will continue to work as before until Django 1.6; in
  291. 1.5 it will raise ``DeprecationWarning``).
  292. The new recommended ``manage.py`` file should look like this::
  293. #!/usr/bin/env python
  294. import os, sys
  295. if __name__ == "__main__":
  296. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
  297. from django.core.management import execute_from_command_line
  298. execute_from_command_line(sys.argv)
  299. ``{{ project_name }}`` should be replaced with the Python package name of the
  300. actual project.
  301. If settings, URLconfs, and apps within the project are imported or referenced
  302. using the project name prefix (e.g. ``myproject.settings``, ``ROOT_URLCONF =
  303. "myproject.urls"``, etc), the new ``manage.py`` will need to be moved one
  304. directory up, so it is outside the project package rather than adjacent to
  305. ``settings.py`` and ``urls.py``.
  306. For instance, with the following layout::
  307. manage.py
  308. mysite/
  309. __init__.py
  310. settings.py
  311. urls.py
  312. myapp/
  313. __init__.py
  314. models.py
  315. You could import ``mysite.settings``, ``mysite.urls``, and ``mysite.myapp``,
  316. but not ``settings``, ``urls``, or ``myapp`` as top-level modules.
  317. Anything imported as a top-level module can be placed adjacent to the new
  318. ``manage.py``. For instance, to decouple "myapp" from the project module and
  319. import it as just ``myapp``, place it outside the ``mysite/`` directory::
  320. manage.py
  321. myapp/
  322. __init__.py
  323. models.py
  324. mysite/
  325. __init__.py
  326. settings.py
  327. urls.py
  328. If the same code is imported inconsistently (some places with the project
  329. prefix, some places without it), the imports will need to be cleaned up when
  330. switching to the new ``manage.py``.
  331. Improved WSGI support
  332. ~~~~~~~~~~~~~~~~~~~~~
  333. The :djadmin:`startproject` management command now adds a :file:`wsgi.py`
  334. module to the initial project layout, containing a simple WSGI application that
  335. can be used for :doc:`deploying with WSGI app
  336. servers</howto/deployment/wsgi/index>`.
  337. The :djadmin:`built-in development server<runserver>` now supports using an
  338. externally-defined WSGI callable, so as to make it possible to run runserver
  339. with the same WSGI configuration that is used for deployment. A new
  340. :setting:`WSGI_APPLICATION` setting is available to configure which WSGI
  341. callable :djadmin:`runserver` uses.
  342. (The :djadmin:`runfcgi` management command also internally wraps the WSGI
  343. callable configured via :setting:`WSGI_APPLICATION`.)
  344. Custom project and app templates
  345. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  346. The :djadmin:`startapp` and :djadmin:`startproject` management commands
  347. got a ``--template`` option for specifying a path or URL to a custom app or
  348. project template.
  349. For example, Django will use the ``/path/to/my_project_template``
  350. directorywhen running the following command::
  351. django-admin.py startproject --template=/path/to/my_project_template myproject
  352. Additionally you can now provide a destination directory as the second
  353. argument to both :djadmin:`startapp` and :djadmin:`startproject`::
  354. django-admin.py startapp myapp /path/to/new/app
  355. django-admin.py startproject myproject /path/to/new/project
  356. For more information see the :djadmin:`startapp` and :djadmin:`startproject`
  357. documentation.
  358. Support for time zones
  359. ~~~~~~~~~~~~~~~~~~~~~~
  360. Django 1.4 adds :ref:`support for time zones <time-zones>`. When it's enabled,
  361. Django stores date and time information in UTC in the database, uses time
  362. zone-aware datetime objects internally, and translates them to the end user's
  363. time zone in templates and forms.
  364. Reasons for using this feature include:
  365. - Customizing date and time display for users around the world.
  366. - Storing datetimes in UTC for database portability and interoperability.
  367. (This argument doesn't apply to PostgreSQL, because it already stores
  368. timestamps with time zone information in Django 1.3.)
  369. - Avoiding data corruption problems around DST transitions.
  370. Time zone support is enabled by default in new projects created with
  371. :djadmin:`startproject`. If you want to use this feature in an existing
  372. project, there is a :ref:`migration guide <time-zones-migration-guide>`.
  373. Minor features
  374. ~~~~~~~~~~~~~~
  375. Django 1.4 also includes several smaller improvements worth noting:
  376. * A more usable stacktrace in the technical 500 page: frames in the
  377. stack trace which reference Django's code are dimmed out, while
  378. frames in user code are slightly emphasized. This change makes it
  379. easier to scan a stacktrace for issues in user code.
  380. * :doc:`Tablespace support </topics/db/tablespaces>` in PostgreSQL.
  381. * Customizable names for :meth:`~django.template.Library.simple_tag`.
  382. * In the documentation, a helpful :doc:`security overview </topics/security>`
  383. page.
  384. * The :func:`django.contrib.auth.models.check_password` function has been moved
  385. to the :mod:`django.contrib.auth.utils` module. Importing it from the old
  386. location will still work, but you should update your imports.
  387. * The :djadmin:`collectstatic` management command gained a ``--clear`` option
  388. to delete all files at the destination before copying or linking the static
  389. files.
  390. * It is now possible to load fixtures containing forward references when using
  391. MySQL with the InnoDB database engine.
  392. * A new 403 response handler has been added as
  393. ``'django.views.defaults.permission_denied'``. You can set your own handler by
  394. setting the value of :data:`django.conf.urls.handler403`. See the
  395. documentation about :ref:`the 403 (HTTP Forbidden) view<http_forbidden_view>`
  396. for more information.
  397. * The :ttag:`trans` template tag now takes an optional ``as`` argument to
  398. be able to retrieve a translation string without displaying it but setting
  399. a template context variable instead.
  400. * The :ttag:`if` template tag now supports ``{% elif %}`` clauses.
  401. * A new plain text version of the HTTP 500 status code internal error page
  402. served when :setting:`DEBUG` is ``True`` is now sent to the client when
  403. Django detects that the request has originated in JavaScript code
  404. (:meth:`~django.http.HttpRequest.is_ajax` is used for this).
  405. Similarly to its HTML counterpart, it contains a collection of different
  406. pieces of information about the state of the web application.
  407. This should make it easier to read when debugging interaction with
  408. client-side Javascript code.
  409. * Added the :djadminopt:`--no-location` option to the :djadmin:`makemessages`
  410. command.
  411. * Changed the ``locmem`` cache backend to use
  412. ``pickle.HIGHEST_PROTOCOL`` for better compatibility with the other
  413. cache backends.
  414. * Added support in the ORM for generating ``SELECT`` queries containing
  415. ``DISTINCT ON``.
  416. The ``distinct()`` ``Queryset`` method now accepts an optional list of model
  417. field names. If specified, then the ``DISTINCT`` statement is limited to these
  418. fields. PostgreSQL is the only database backend shipped with Django that
  419. supports this new functionality.
  420. For more details, see the documentation for
  421. :meth:`~django.db.models.query.QuerySet.distinct`.
  422. Backwards incompatible changes in 1.4
  423. =====================================
  424. django.contrib.admin
  425. ~~~~~~~~~~~~~~~~~~~~
  426. The included administration app ``django.contrib.admin`` has for a long time
  427. shipped with a default set of static files such as JavaScript, images and
  428. stylesheets. Django 1.3 added a new contrib app ``django.contrib.staticfiles``
  429. to handle such files in a generic way and defined conventions for static
  430. files included in apps.
  431. Starting in Django 1.4 the admin's static files also follow this
  432. convention to make it easier to deploy the included files. In previous
  433. versions of Django, it was also common to define an ``ADMIN_MEDIA_PREFIX``
  434. setting to point to the URL where the admin's static files are served by a
  435. web server. This setting has now been deprecated and replaced by the more
  436. general setting :setting:`STATIC_URL`. Django will now expect to find the
  437. admin static files under the URL ``<STATIC_URL>/admin/``.
  438. If you've previously used a URL path for ``ADMIN_MEDIA_PREFIX`` (e.g.
  439. ``/media/``) simply make sure :setting:`STATIC_URL` and :setting:`STATIC_ROOT`
  440. are configured and your web server serves the files correctly. The development
  441. server continues to serve the admin files just like before. Don't hesitate to
  442. consult the :doc:`static files howto </howto/static-files>` for further
  443. details.
  444. In case your ``ADMIN_MEDIA_PREFIX`` is set to an specific domain (e.g.
  445. ``http://media.example.com/admin/``) make sure to also set your
  446. :setting:`STATIC_URL` setting to the correct URL, for example
  447. ``http://media.example.com/``.
  448. .. warning::
  449. If you're implicitely relying on the path of the admin static files on
  450. your server's file system when you deploy your site, you have to update
  451. that path. The files were moved from :file:`django/contrib/admin/media/`
  452. to :file:`django/contrib/admin/static/admin/`.
  453. Supported browsers for the admin
  454. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  455. Django hasn't had a clear policy on which browsers are supported for using the
  456. admin app. Django's new policy formalizes existing practices: `YUI's A-grade`_
  457. browsers should provide a fully-functional admin experience, with the notable
  458. exception of IE6, which is no longer supported.
  459. Released over ten years ago, IE6 imposes many limitations on modern web
  460. development. The practical implications of this policy are that contributors
  461. are free to improve the admin without consideration for these limitations.
  462. This new policy **has no impact** on development outside of the admin. Users of
  463. Django are free to develop webapps compatible with any range of browsers.
  464. .. _YUI's A-grade: http://yuilibrary.com/yui/docs/tutorials/gbs/
  465. Removed admin icons
  466. ~~~~~~~~~~~~~~~~~~~
  467. As part of an effort to improve the performance and usability of the admin's
  468. changelist sorting interface and of the admin's :attr:`horizontal
  469. <django.contrib.admin.ModelAdmin.filter_horizontal>` and :attr:`vertical
  470. <django.contrib.admin.ModelAdmin.filter_vertical>` "filter" widgets, some icon
  471. files were removed and grouped into two sprite files.
  472. Specifically: ``selector-add.gif``, ``selector-addall.gif``,
  473. ``selector-remove.gif``, ``selector-removeall.gif``,
  474. ``selector_stacked-add.gif`` and ``selector_stacked-remove.gif`` were
  475. combined into ``selector-icons.gif``; and ``arrow-up.gif`` and
  476. ``arrow-down.gif`` were combined into ``sorting-icons.gif``.
  477. If you used those icons to customize the admin then you will want to replace
  478. them with your own icons or retrieve them from a previous release.
  479. CSS class names in admin forms
  480. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  481. To avoid conflicts with other common CSS class names (e.g. "button"), a prefix
  482. "field-" has been added to all CSS class names automatically generated from the
  483. form field names in the main admin forms, stacked inline forms and tabular
  484. inline cells. You will need to take that prefix into account in your custom
  485. style sheets or javascript files if you previously used plain field names as
  486. selectors for custom styles or javascript transformations.
  487. Compatibility with old signed data
  488. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  489. Django 1.3 changed the cryptographic signing mechanisms used in a number of
  490. places in Django. While Django 1.3 kept fallbacks that would accept hashes
  491. produced by the previous methods, these fallbacks are removed in Django 1.4.
  492. So, if you upgrade to Django 1.4 directly from 1.2 or earlier, you may
  493. lose/invalidate certain pieces of data that have been cryptographically signed
  494. using an old method. To avoid this, use Django 1.3 first for a period of time
  495. to allow the signed data to expire naturally. The affected parts are detailed
  496. below, with 1) the consequences of ignoring this advice and 2) the amount of
  497. time you need to run Django 1.3 for the data to expire or become irrelevant.
  498. * ``contrib.sessions`` data integrity check
  499. * consequences: the user will be logged out, and session data will be lost.
  500. * time period: defined by :setting:`SESSION_COOKIE_AGE`.
  501. * ``contrib.auth`` password reset hash
  502. * consequences: password reset links from before the upgrade will not work.
  503. * time period: defined by :setting:`PASSWORD_RESET_TIMEOUT_DAYS`.
  504. Form-related hashes — these are much shorter lifetime, and are relevant only for
  505. the short window where a user might fill in a form generated by the pre-upgrade
  506. Django instance, and try to submit it to the upgraded Django instance:
  507. * ``contrib.comments`` form security hash
  508. * consequences: the user will see a validation error "Security hash failed".
  509. * time period: the amount of time you expect users to take filling out comment
  510. forms.
  511. * ``FormWizard`` security hash
  512. * consequences: the user will see an error about the form having expired,
  513. and will be sent back to the first page of the wizard, losing the data
  514. they have entered so far.
  515. * time period: the amount of time you expect users to take filling out the
  516. affected forms.
  517. * CSRF check
  518. * Note: This is actually a Django 1.1 fallback, not Django 1.2,
  519. and applies only if you are upgrading from 1.1.
  520. * consequences: the user will see a 403 error with any CSRF protected POST
  521. form.
  522. * time period: the amount of time you expect user to take filling out
  523. such forms.
  524. django.contrib.flatpages
  525. ~~~~~~~~~~~~~~~~~~~~~~~~
  526. Starting in the 1.4 release the
  527. :class:`~django.contrib.flatpages.middleware.FlatpageFallbackMiddleware` only
  528. adds a trailing slash and redirects if the resulting URL refers to an existing
  529. flatpage. For example, requesting ``/notaflatpageoravalidurl`` in a previous
  530. version would redirect to ``/notaflatpageoravalidurl/``, which would
  531. subsequently raise a 404. Requesting ``/notaflatpageoravalidurl`` now will
  532. immediately raise a 404. Additionally redirects returned by flatpages are now
  533. permanent (301 status code) to match the behavior of the
  534. :class:`~django.middleware.common.CommonMiddleware`.
  535. Serialization of :class:`~datetime.datetime` and :class:`~datetime.time`
  536. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  537. As a consequence of time zone support, and according to the ECMA-262
  538. specification, some changes were made to the JSON serializer:
  539. - It includes the time zone for aware datetime objects. It raises an exception
  540. for aware time objects.
  541. - It includes milliseconds for datetime and time objects. There is still
  542. some precision loss, because Python stores microseconds (6 digits) and JSON
  543. only supports milliseconds (3 digits). However, it's better than discarding
  544. microseconds entirely.
  545. The XML serializer was also changed to use the ISO8601 format for datetimes.
  546. The letter ``T`` is used to separate the date part from the time part, instead
  547. of a space. Time zone information is included in the ``[+-]HH:MM`` format.
  548. The serializers will dump datetimes in fixtures with these new formats. They
  549. can still load fixtures that use the old format.
  550. ``supports_timezone`` changed to ``False`` for SQLite
  551. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  552. The database feature ``supports_timezone`` used to be ``True`` for SQLite.
  553. Indeed, if you saved an aware datetime object, SQLite stored a string that
  554. included an UTC offset. However, this offset was ignored when loading the value
  555. back from the database, which could corrupt the data.
  556. In the context of time zone support, this flag was changed to ``False``, and
  557. datetimes are now stored without time zone information in SQLite. When
  558. :setting:`USE_TZ` is ``False``, if you attempt to save an aware datetime
  559. object, Django raises an exception.
  560. Database connection's thread-locality
  561. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  562. ``DatabaseWrapper`` objects (i.e. the connection objects referenced by
  563. ``django.db.connection`` and ``django.db.connections["some_alias"]``) used to
  564. be thread-local. They are now global objects in order to be potentially shared
  565. between multiple threads. While the individual connection objects are now
  566. global, the ``django.db.connections`` dictionary referencing those objects is
  567. still thread-local. Therefore if you just use the ORM or
  568. ``DatabaseWrapper.cursor()`` then the behavior is still the same as before.
  569. Note, however, that ``django.db.connection`` does not directly reference the
  570. default ``DatabaseWrapper`` object anymore and is now a proxy to access that
  571. object's attributes. If you need to access the actual ``DatabaseWrapper``
  572. object, use ``django.db.connections[DEFAULT_DB_ALIAS]`` instead.
  573. As part of this change, all underlying SQLite connections are now enabled for
  574. potential thread-sharing (by passing the ``check_same_thread=False`` attribute
  575. to pysqlite). ``DatabaseWrapper`` however preserves the previous behavior by
  576. disabling thread-sharing by default, so this does not affect any existing
  577. code that purely relies on the ORM or on ``DatabaseWrapper.cursor()``.
  578. Finally, while it is now possible to pass connections between threads, Django
  579. does not make any effort to synchronize access to the underlying backend.
  580. Concurrency behavior is defined by the underlying backend implementation.
  581. Check their documentation for details.
  582. `COMMENTS_BANNED_USERS_GROUP` setting
  583. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  584. Django's :doc:`comments app </ref/contrib/comments/index>` has historically
  585. supported excluding the comments of a special user group, but we've never
  586. documented the feature properly and didn't enforce the exclusion in other parts
  587. of the app such as the template tags. To fix this problem, we removed the code
  588. from the feed class.
  589. If you rely on the feature and want to restore the old behavior, simply use
  590. a custom comment model manager to exclude the user group, like this::
  591. from django.conf import settings
  592. from django.contrib.comments.managers import CommentManager
  593. class BanningCommentManager(CommentManager):
  594. def get_query_set(self):
  595. qs = super(BanningCommentManager, self).get_query_set()
  596. if getattr(settings, 'COMMENTS_BANNED_USERS_GROUP', None):
  597. where = ['user_id NOT IN (SELECT user_id FROM auth_user_groups WHERE group_id = %s)']
  598. params = [settings.COMMENTS_BANNED_USERS_GROUP]
  599. qs = qs.extra(where=where, params=params)
  600. return qs
  601. Save this model manager in your custom comment app (e.g. in
  602. ``my_comments_app/managers.py``) and add it your
  603. :ref:`custom comment app model <custom-comment-app-api>`::
  604. from django.db import models
  605. from django.contrib.comments.models import Comment
  606. from my_comments_app.managers import BanningCommentManager
  607. class CommentWithTitle(Comment):
  608. title = models.CharField(max_length=300)
  609. objects = BanningCommentManager()
  610. For more details, see the documentation about
  611. :doc:`customizing the comments framework </ref/contrib/comments/custom>`.
  612. `IGNORABLE_404_STARTS` and `IGNORABLE_404_ENDS` settings
  613. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  614. Until Django 1.3, it was possible to exclude some URLs from Django's
  615. :doc:`404 error reporting</howto/error-reporting>` by adding prefixes to
  616. :setting:`IGNORABLE_404_STARTS` and suffixes to :setting:`IGNORABLE_404_ENDS`.
  617. In Django 1.4, these two settings are superseded by
  618. :setting:`IGNORABLE_404_URLS`, which is a list of compiled regular expressions.
  619. Django won't send an email for 404 errors on URLs that match any of them.
  620. Furthermore, the previous settings had some rather arbitrary default values::
  621. IGNORABLE_404_STARTS = ('/cgi-bin/', '/_vti_bin', '/_vti_inf')
  622. IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi',
  623. 'favicon.ico', '.php')
  624. It's not Django's role to decide if your website has a legacy ``/cgi-bin/``
  625. section or a ``favicon.ico``. As a consequence, the default values of
  626. :setting:`IGNORABLE_404_URLS`, :setting:`IGNORABLE_404_STARTS` and
  627. :setting:`IGNORABLE_404_ENDS` are all now empty.
  628. If you have customized :setting:`IGNORABLE_404_STARTS` or
  629. :setting:`IGNORABLE_404_ENDS`, or if you want to keep the old default value,
  630. you should add the following lines in your settings file::
  631. import re
  632. IGNORABLE_404_URLS = (
  633. # for each <prefix> in IGNORABLE_404_STARTS
  634. re.compile(r'^<prefix>'),
  635. # for each <suffix> in IGNORABLE_404_ENDS
  636. re.compile(r'<suffix>$'),
  637. )
  638. Don't forget to escape characters that have a special meaning in a regular
  639. expression.
  640. CSRF protection extended to PUT and DELETE
  641. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  642. Previously, Django's :doc:`CSRF protection </ref/contrib/csrf/>` provided
  643. protection against only POST requests. Since use of PUT and DELETE methods in
  644. AJAX applications is becoming more common, we now protect all methods not
  645. defined as safe by :rfc:`2616` i.e. we exempt GET, HEAD, OPTIONS and TRACE, and
  646. enforce protection on everything else.
  647. If you are using PUT or DELETE methods in AJAX applications, please see the
  648. :ref:`instructions about using AJAX and CSRF <csrf-ajax>`.
  649. ``django.core.template_loaders``
  650. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  651. This was an alias to ``django.template.loader`` since 2005, it has been removed
  652. without emitting a warning due to the length of the deprecation. If your code
  653. still referenced this please use ``django.template.loader`` instead.
  654. ``django.db.models.fields.URLField.verify_exists``
  655. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  656. This functionality has been removed due to intractable performance and
  657. security issues. Any existing usage of ``verify_exists`` should be
  658. removed.
  659. ``django.core.files.storage.Storage.open``
  660. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  661. The ``open`` method of the base Storage class took an obscure parameter
  662. ``mixin`` which allowed you to dynamically change the base classes of the
  663. returned file object. This has been removed. In the rare case you relied on the
  664. `mixin` parameter, you can easily achieve the same by overriding the `open`
  665. method, e.g.::
  666. from django.core.files import File
  667. from django.core.files.storage import FileSystemStorage
  668. class Spam(File):
  669. """
  670. Spam, spam, spam, spam and spam.
  671. """
  672. def ham(self):
  673. return 'eggs'
  674. class SpamStorage(FileSystemStorage):
  675. """
  676. A custom file storage backend.
  677. """
  678. def open(self, name, mode='rb'):
  679. return Spam(open(self.path(name), mode))
  680. YAML deserializer now uses ``yaml.safe_load``
  681. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  682. ``yaml.load`` is able to construct any Python object, which may trigger
  683. arbitrary code execution if you process a YAML document that comes from an
  684. untrusted source. This feature isn't necessary for Django's YAML deserializer,
  685. whose primary use is to load fixtures consisting of simple objects. Even though
  686. fixtures are trusted data, for additional security, the YAML deserializer now
  687. uses ``yaml.safe_load``.
  688. Features deprecated in 1.4
  689. ==========================
  690. Old styles of calling ``cache_page`` decorator
  691. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  692. Some legacy ways of calling :func:`~django.views.decorators.cache.cache_page`
  693. have been deprecated, please see the docs for the correct way to use this
  694. decorator.
  695. Support for PostgreSQL versions older than 8.2
  696. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  697. Django 1.3 dropped support for PostgreSQL versions older than 8.0 and the
  698. relevant documents suggested to use a recent version because of performance
  699. reasons but more importantly because end of the upstream support periods for
  700. releases 8.0 and 8.1 was near (November 2010).
  701. Django 1.4 takes that policy further and sets 8.2 as the minimum PostgreSQL
  702. version it officially supports.
  703. Request exceptions are now always logged
  704. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  705. When :doc:`logging support </topics/logging/>` was added to Django in 1.3, the
  706. admin error email support was moved into the
  707. :class:`django.utils.log.AdminEmailHandler`, attached to the
  708. ``'django.request'`` logger. In order to maintain the established behavior of
  709. error emails, the ``'django.request'`` logger was called only when
  710. :setting:`DEBUG` was ``False``.
  711. To increase the flexibility of error logging for requests, the
  712. ``'django.request'`` logger is now called regardless of the value of
  713. :setting:`DEBUG`, and the default settings file for new projects now includes a
  714. separate filter attached to :class:`django.utils.log.AdminEmailHandler` to
  715. prevent admin error emails in ``DEBUG`` mode::
  716. 'filters': {
  717. 'require_debug_false': {
  718. '()': 'django.utils.log.RequireDebugFalse'
  719. }
  720. },
  721. 'handlers': {
  722. 'mail_admins': {
  723. 'level': 'ERROR',
  724. 'filters': ['require_debug_false'],
  725. 'class': 'django.utils.log.AdminEmailHandler'
  726. }
  727. },
  728. If your project was created prior to this change, your :setting:`LOGGING`
  729. setting will not include this new filter. In order to maintain
  730. backwards-compatibility, Django will detect that your ``'mail_admins'`` handler
  731. configuration includes no ``'filters'`` section, and will automatically add
  732. this filter for you and issue a pending-deprecation warning. This will become a
  733. deprecation warning in Django 1.5, and in Django 1.6 the
  734. backwards-compatibility shim will be removed entirely.
  735. The existence of any ``'filters'`` key under the ``'mail_admins'`` handler will
  736. disable this backward-compatibility shim and deprecation warning.
  737. ``django.conf.urls.defaults``
  738. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  739. Until Django 1.3 the functions :func:`~django.conf.urls.include`,
  740. :func:`~django.conf.urls.patterns` and :func:`~django.conf.urls.url` plus
  741. :data:`~django.conf.urls.handler404`, :data:`~django.conf.urls.handler500`
  742. were located in a ``django.conf.urls.defaults`` module.
  743. Starting with Django 1.4 they are now available in :mod:`django.conf.urls`.
  744. ``django.contrib.databrowse``
  745. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  746. Databrowse has not seen active development for some time, and this does not show
  747. any sign of changing. There had been a suggestion for a `GSOC project`_ to
  748. integrate the functionality of databrowse into the admin, but no progress was
  749. made. While Databrowse has been deprecated, an enhancement of
  750. ``django.contrib.admin`` providing a similar feature set is still possible.
  751. .. _GSOC project: https://code.djangoproject.com/wiki/SummerOfCode2011#Integratedatabrowseintotheadmin
  752. The code that powers Databrowse is licensed under the same terms as Django
  753. itself, and so is available to be adopted by an individual or group as
  754. a third-party project.
  755. ``django.core.management.setup_environ``
  756. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  757. This function temporarily modified ``sys.path`` in order to make the parent
  758. "project" directory importable under the old flat :djadmin:`startproject`
  759. layout. This function is now deprecated, as its path workarounds are no longer
  760. needed with the new ``manage.py`` and default project layout.
  761. This function was never documented or part of the public API, but was widely
  762. recommended for use in setting up a "Django environment" for a user script.
  763. These uses should be replaced by setting the ``DJANGO_SETTINGS_MODULE``
  764. environment variable or using :func:`django.conf.settings.configure`.
  765. ``django.core.management.execute_manager``
  766. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  767. This function was previously used by ``manage.py`` to execute a management
  768. command. It is identical to
  769. ``django.core.management.execute_from_command_line``, except that it first
  770. calls ``setup_environ``, which is now deprecated. As such, ``execute_manager``
  771. is also deprecated; ``execute_from_command_line`` can be used instead. Neither
  772. of these functions is documented as part of the public API, but a deprecation
  773. path is needed due to use in existing ``manage.py`` files.
  774. ``is_safe`` and ``needs_autoescape`` attributes of template filters
  775. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  776. Two flags, ``is_safe`` and ``needs_autoescape``, define how each template filter
  777. interacts with Django's auto-escaping behavior. They used to be attributes of
  778. the filter function::
  779. @register.filter
  780. def noop(value):
  781. return value
  782. noop.is_safe = True
  783. However, this technique caused some problems in combination with decorators,
  784. especially :func:`@stringfilter <django.template.defaultfilters.stringfilter>`.
  785. Now, the flags are keyword arguments of :meth:`@register.filter
  786. <django.template.Library.filter>`::
  787. @register.filter(is_safe=True)
  788. def noop(value):
  789. return value
  790. See :ref:`filters and auto-escaping <filters-auto-escaping>` for more information.
  791. Session cookies now have the ``httponly`` flag by default
  792. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  793. Session cookies now include the ``httponly`` attribute by default to
  794. help reduce the impact of potential XSS attacks. For strict backwards
  795. compatibility, use ``SESSION_COOKIE_HTTPONLY = False`` in your settings file.
  796. Wildcard expansion of application names in `INSTALLED_APPS`
  797. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  798. Until Django 1.3, :setting:`INSTALLED_APPS` accepted wildcards in application
  799. names, like ``django.contrib.*``. The expansion was performed by a
  800. filesystem-based implementation of ``from <package> import *``. Unfortunately,
  801. `this can't be done reliably`_.
  802. This behavior was never documented. Since it is un-pythonic and not obviously
  803. useful, it was removed in Django 1.4. If you relied on it, you must edit your
  804. settings file to list all your applications explicitly.
  805. .. _this can't be done reliably: http://docs.python.org/tutorial/modules.html#importing-from-a-package
  806. ``HttpRequest.raw_post_data`` renamed to ``HttpRequest.body``
  807. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  808. This attribute was confusingly named ``HttpRequest.raw_post_data``, but it
  809. actually provided the body of the HTTP request. It's been renamed to
  810. ``HttpRequest.body``, and ``HttpRequest.raw_post_data`` has been deprecated.
  811. The Django 1.4 roadmap
  812. ======================
  813. Before the final Django 1.4 release, several other preview/development releases
  814. will be made available. The current schedule consists of at least the following:
  815. * Week of **January 30, 2012**: First Django 1.4 beta release; final
  816. feature freeze for Django 1.4.
  817. * Week of **February 27, 2012**: First Django 1.4 release
  818. candidate; string freeze for translations.
  819. * Week of **March 5, 2011**: Django 1.4 final release.
  820. If necessary, additional alpha, beta or release-candidate packages
  821. will be issued prior to the final 1.4 release. Django 1.4 will be
  822. released approximately one week after the final release candidate.
  823. What you can do to help
  824. =======================
  825. In order to provide a high-quality 1.4 release, we need your help. Although this
  826. alpha release is, again, *not* intended for production use, you can help the
  827. Django team by trying out the alpha codebase in a safe test environment and
  828. reporting any bugs or issues you encounter. The Django ticket tracker is the
  829. central place to search for open issues:
  830. * http://code.djangoproject.com/timeline
  831. Please open new tickets if no existing ticket corresponds to a problem you're
  832. running into.
  833. Additionally, discussion of Django development, including progress toward the
  834. 1.3 release, takes place daily on the django-developers mailing list:
  835. * http://groups.google.com/group/django-developers
  836. ... and in the ``#django-dev`` IRC channel on ``irc.freenode.net``. If you're
  837. interested in helping out with Django's development, feel free to join the
  838. discussions there.
  839. Django's online documentation also includes pointers on how to contribute to
  840. Django:
  841. * :doc:`How to contribute to Django </internals/contributing/index>`
  842. Contributions on any level -- developing code, writing documentation or simply
  843. triaging tickets and helping to test proposed bugfixes -- are always welcome and
  844. appreciated.
  845. Several development sprints will also be taking place before the 1.4
  846. release; these will typically be announced in advance on the
  847. django-developers mailing list, and anyone who wants to help is
  848. welcome to join in.