1.7.txt 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. Schema migrations
  26. ~~~~~~~~~~~~~~~~~
  27. Django now has built-in support for schema migrations, which allows models
  28. to be updated, changed and deleted and the changes stored into migration files
  29. and then run on any deployed database.
  30. Migrations are covered in :doc:`their own documentation</topics/migrations>`,
  31. but a few of the key features are:
  32. * ``syncdb`` has been deprecated and replaced by ``migrate``. Don't worry -
  33. calls to ``syncdb`` will still work as before.
  34. * A new ``makemigrations`` command provides an easy way to autodetect changes
  35. to your models and make migrations for them.
  36. * :data:`~django.db.models.signals.post_syncdb` and
  37. :data:`~django.db.models.signals.post_syncdb` have been renamed to
  38. :data:`~django.db.models.signals.pre_migrate` and
  39. :data:`~django.db.models.signals.post_migrate` respectively. The
  40. ``create_models``/``created_models`` argument has also been deprecated.
  41. * The ``allow_syncdb`` method on database routers is now called ``allow_migrate``,
  42. but still performs the same function. Routers with ``allow_syncdb`` methods
  43. will still work, but that method name is deprecated and you should change
  44. it as soon as possible (nothing more than renaming is required).
  45. Admin shortcuts support time zones
  46. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47. The "today" and "now" shortcuts next to date and time input widgets in the
  48. admin are now operating in the :ref:`current time zone
  49. <default-current-time-zone>`. Previously, they used the browser time zone,
  50. which could result in saving the wrong value when it didn't match the current
  51. time zone on the server.
  52. In addition, the widgets now display a help message when the browser and
  53. server time zone are different, to clarify how the value inserted in the field
  54. will be interpreted.
  55. Minor features
  56. ~~~~~~~~~~~~~~
  57. * The new :attr:`UploadedFile.content_type_extra
  58. <django.core.files.uploadedfile.UploadedFile.content_type_extra>` attribute
  59. contains extra parameters passed to the ``content-type`` header on a file
  60. upload.
  61. * The ``enter`` argument was added to the
  62. :data:`~django.test.signals.setting_changed` signal.
  63. * The :meth:`QuerySet.update_or_create()
  64. <django.db.models.query.QuerySet.update_or_create>` method was added.
  65. * :attr:`~django.db.models.Options.app_label` is no longer required for models
  66. that are defined in a ``models`` package within an app.
  67. * The :meth:`Context.push() <django.template.Context.push>` method now returns
  68. a context manager which automatically calls :meth:`pop()
  69. <django.template.Context.pop>` upon exiting the ``with`` statement.
  70. Additionally, :meth:`push() <django.template.Context.push>` now accepts
  71. parameters that are passed to the ``dict`` constructor used to build the new
  72. context level.
  73. * The :class:`~django.utils.feedgenerator.Atom1Feed` syndication feed's
  74. ``updated`` element now utilizes `updateddate` instead of ``pubdate``,
  75. allowing the ``published`` element to be included in the feed (which
  76. relies on ``pubdate``).
  77. Backwards incompatible changes in 1.7
  78. =====================================
  79. .. warning::
  80. In addition to the changes outlined in this section, be sure to review the
  81. :doc:`deprecation plan </internals/deprecation>` for any features that
  82. have been removed. If you haven't updated your code within the
  83. deprecation timeline for a given feature, its removal may appear as a
  84. backwards incompatible change.
  85. allow_syncdb/allow_migrate
  86. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  87. While Django will still look at ``allow_syncdb`` methods even though they
  88. should be renamed to ``allow_migrate``, there is a subtle difference in which
  89. models get passed to these methods.
  90. For apps with migrations, ``allow_migrate`` will now get passed
  91. :ref:`historical models <historical-models>`, which are special versioned models
  92. without custom attributes, methods or managers. Make sure your ``allow_migrate``
  93. methods are only referring to fields or other items in ``model._meta``.
  94. Miscellaneous
  95. ~~~~~~~~~~~~~
  96. * The :meth:`django.core.files.uploadhandler.FileUploadHandler.new_file()`
  97. method is now passed an additional ``content_type_extra`` parameter. If you
  98. have a custom :class:`~django.core.files.uploadhandler.FileUploadHandler`
  99. that implements ``new_file()``, be sure it accepts this new parameter.
  100. Features deprecated in 1.7
  101. ==========================
  102. ``django.utils.dictconfig``
  103. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104. ``django.utils.dictconfig`` was a copy of :mod:`logging.config` provided for
  105. Python versions prior to 2.7. It has been deprecated.
  106. ``django.utils.unittest``
  107. ~~~~~~~~~~~~~~~~~~~~~~~~~
  108. ``django.utils.unittest`` provided uniform access to the ``unittest2`` library
  109. on all Python versions. Since ``unittest2`` became the standard library's
  110. :mod:`unittest` module in Python 2.7, and Django 1.7 drops support for older
  111. Python versions, this module isn't useful anymore. It has been deprecated. Use
  112. :mod:`unittest` instead.