1.7.txt 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. ============================================
  2. Django 1.7 release notes - UNDER DEVELOPMENT
  3. ============================================
  4. Welcome to Django 1.7!
  5. These release notes cover the `new features`_, as well as some `backwards
  6. incompatible changes`_ you'll want to be aware of when upgrading from Django
  7. 1.6 or older versions. We've also dropped some features, which are detailed in
  8. :doc:`our deprecation plan </internals/deprecation>`, and we've `begun the
  9. deprecation process for some features`_.
  10. .. _`new features`: `What's new in Django 1.7`_
  11. .. _`backwards incompatible changes`: `Backwards incompatible changes in 1.7`_
  12. .. _`begun the deprecation process for some features`: `Features deprecated in 1.7`_
  13. Python compatibility
  14. ====================
  15. Django 1.7 requires Python 2.7 or above, though we **highly recommend**
  16. the latest minor release. Support for Python 2.6 has been dropped.
  17. This change should affect only a small number of Django users, as most
  18. operating-system vendors today are shipping Python 2.7 or newer as their default
  19. version. If you're still using Python 2.6, however, you'll need to stick to
  20. Django 1.6 until you can upgrade your Python version. Per :doc:`our support
  21. policy </internals/release-process>`, Django 1.6 will continue to receive
  22. security support until the release of Django 1.8.
  23. What's new in Django 1.7
  24. ========================
  25. Calling custom ``QuerySet`` methods from the ``Manager``
  26. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. The :meth:`QuerySet.as_manager() <django.db.models.query.QuerySet.as_manager>`
  28. class method has been added to :ref:`create Manager with QuerySet methods
  29. <create-manager-with-queryset-methods>`.
  30. Admin shortcuts support time zones
  31. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32. The "today" and "now" shortcuts next to date and time input widgets in the
  33. admin are now operating in the :ref:`current time zone
  34. <default-current-time-zone>`. Previously, they used the browser time zone,
  35. which could result in saving the wrong value when it didn't match the current
  36. time zone on the server.
  37. In addition, the widgets now display a help message when the browser and
  38. server time zone are different, to clarify how the value inserted in the field
  39. will be interpreted.
  40. Minor features
  41. ~~~~~~~~~~~~~~
  42. * The new :attr:`UploadedFile.content_type_extra
  43. <django.core.files.uploadedfile.UploadedFile.content_type_extra>` attribute
  44. contains extra parameters passed to the ``content-type`` header on a file
  45. upload.
  46. * The ``enter`` argument was added to the
  47. :data:`~django.test.signals.setting_changed` signal.
  48. * The :meth:`QuerySet.update_or_create()
  49. <django.db.models.query.QuerySet.update_or_create>` method was added.
  50. * :attr:`~django.db.models.Options.app_label` is no longer required for models
  51. that are defined in a ``models`` package within an app.
  52. * The :meth:`Context.push() <django.template.Context.push>` method now returns
  53. a context manager which automatically calls :meth:`pop()
  54. <django.template.Context.pop>` upon exiting the ``with`` statement.
  55. Additionally, :meth:`push() <django.template.Context.push>` now accepts
  56. parameters that are passed to the ``dict`` constructor used to build the new
  57. context level.
  58. * The :class:`~django.utils.feedgenerator.Atom1Feed` syndication feed's
  59. ``updated`` element now utilizes `updateddate` instead of ``pubdate``,
  60. allowing the ``published`` element to be included in the feed (which
  61. relies on ``pubdate``).
  62. * Buttons in :mod:`django.contrib.admin` now use the ``border-radius`` CSS
  63. property for rounded corners rather than GIF background images.
  64. * Some admin templates now have ``app-<app_name>`` and ``model-<model_name>``
  65. classes in their ``<body>`` tag to allow customizing the CSS per app or per
  66. model.
  67. * The admin changelist cells now have a ``field-<field_name>`` class in the
  68. HTML to enable style customizations.
  69. * The :func:`~django.core.mail.send_mail` now accepts an ``html_message``
  70. parameter for sending a multipart text/plain and text/html email.
  71. Backwards incompatible changes in 1.7
  72. =====================================
  73. .. warning::
  74. In addition to the changes outlined in this section, be sure to review the
  75. :doc:`deprecation plan </internals/deprecation>` for any features that
  76. have been removed. If you haven't updated your code within the
  77. deprecation timeline for a given feature, its removal may appear as a
  78. backwards incompatible change.
  79. Miscellaneous
  80. ~~~~~~~~~~~~~
  81. * The :meth:`django.core.files.uploadhandler.FileUploadHandler.new_file()`
  82. method is now passed an additional ``content_type_extra`` parameter. If you
  83. have a custom :class:`~django.core.files.uploadhandler.FileUploadHandler`
  84. that implements ``new_file()``, be sure it accepts this new parameter.
  85. * :class:`ModelFormSet<django.forms.models.BaseModelFormSet>`'s no longer
  86. delete instances when ``save(commit=False)`` is called. See
  87. :attr:`~django.forms.formsets.BaseFormSet.can_delete` for instructions on how
  88. to manually delete objects from deleted forms.
  89. * Loading empty fixtures emits a ``RuntimeWarning`` rather than raising
  90. :class:`~django.core.management.CommandError`.
  91. Features deprecated in 1.7
  92. ==========================
  93. ``django.utils.dictconfig``
  94. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  95. ``django.utils.dictconfig`` was a copy of :mod:`logging.config` provided for
  96. Python versions prior to 2.7. It has been deprecated.
  97. ``django.utils.unittest``
  98. ~~~~~~~~~~~~~~~~~~~~~~~~~
  99. ``django.utils.unittest`` provided uniform access to the ``unittest2`` library
  100. on all Python versions. Since ``unittest2`` became the standard library's
  101. :mod:`unittest` module in Python 2.7, and Django 1.7 drops support for older
  102. Python versions, this module isn't useful anymore. It has been deprecated. Use
  103. :mod:`unittest` instead.
  104. Custom SQL location for models package
  105. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  106. Previously, if models were organized in a package (``myapp/models/``) rather
  107. than simply ``myapp/models.py``, Django would look for :ref:`initial SQL data
  108. <initial-sql>` in ``myapp/models/sql/``. This bug has been fixed so that Django
  109. will search ``myapp/sql/`` as documented. The old location will continue to
  110. work until Django 1.9.