0.96.txt 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. =================================
  2. Django version 0.96 release notes
  3. =================================
  4. Welcome to Django 0.96!
  5. The primary goal for 0.96 is a cleanup and stabilization of the features
  6. introduced in 0.95. There have been a few small `backwards-incompatible
  7. changes`_ since 0.95, but the upgrade process should be fairly simple
  8. and should not require major changes to existing applications.
  9. However, we're also releasing 0.96 now because we have a set of
  10. backwards-incompatible changes scheduled for the near future. Once
  11. completed, they will involve some code changes for application
  12. developers, so we recommend that you stick with Django 0.96 until the
  13. next official release; then you'll be able to upgrade in one step
  14. instead of needing to make incremental changes to keep up with the
  15. development version of Django.
  16. Backwards-incompatible changes
  17. ==============================
  18. The following changes may require you to update your code when you switch from
  19. 0.95 to 0.96:
  20. ``MySQLdb`` version requirement
  21. -------------------------------
  22. Due to a bug in older versions of the ``MySQLdb`` Python module (which
  23. Django uses to connect to MySQL databases), Django's MySQL backend now
  24. requires version 1.2.1p2 or higher of ``MySQLdb``, and will raise
  25. exceptions if you attempt to use an older version.
  26. If you're currently unable to upgrade your copy of ``MySQLdb`` to meet
  27. this requirement, a separate, backwards-compatible backend, called
  28. "mysql_old", has been added to Django. To use this backend, change
  29. the ``DATABASE_ENGINE`` setting in your Django settings file from this::
  30. DATABASE_ENGINE = "mysql"
  31. to this::
  32. DATABASE_ENGINE = "mysql_old"
  33. However, we strongly encourage MySQL users to upgrade to a more recent
  34. version of ``MySQLdb`` as soon as possible, The "mysql_old" backend is
  35. provided only to ease this transition, and is considered deprecated;
  36. aside from any necessary security fixes, it will not be actively
  37. maintained, and it will be removed in a future release of Django.
  38. Also, note that some features, like the new ``DATABASE_OPTIONS``
  39. setting (see the :doc:`databases documentation </ref/databases>` for details),
  40. are only available on the "mysql" backend, and will not be made available for
  41. "mysql_old".
  42. Database constraint names changed
  43. ---------------------------------
  44. The format of the constraint names Django generates for foreign key
  45. references have changed slightly. These names are generally only used
  46. when it is not possible to put the reference directly on the affected
  47. column, so they are not always visible.
  48. The effect of this change is that running ``manage.py reset`` and
  49. similar commands against an existing database may generate SQL with
  50. the new form of constraint name, while the database itself contains
  51. constraints named in the old form; this will cause the database server
  52. to raise an error message about modifying nonexistent constraints.
  53. If you need to work around this, there are two methods available:
  54. 1. Redirect the output of ``manage.py`` to a file, and edit the
  55. generated SQL to use the correct constraint names before
  56. executing it.
  57. 2. Examine the output of ``manage.py sqlall`` to see the new-style
  58. constraint names, and use that as a guide to rename existing
  59. constraints in your database.
  60. Name changes in ``manage.py``
  61. -----------------------------
  62. A few of the options to ``manage.py`` have changed with the addition of fixture
  63. support:
  64. * There are new ``dumpdata`` and ``loaddata`` commands which, as
  65. you might expect, will dump and load data to/from the
  66. database. These commands can operate against any of Django's
  67. supported serialization formats.
  68. * The ``sqlinitialdata`` command has been renamed to ``sqlcustom`` to
  69. emphasize that ``loaddata`` should be used for data (and ``sqlcustom`` for
  70. other custom SQL -- views, stored procedures, etc.).
  71. * The vestigial ``install`` command has been removed. Use ``syncdb``.
  72. Backslash escaping changed
  73. --------------------------
  74. The Django database API now escapes backslashes given as query parameters. If
  75. you have any database API code that matches backslashes, and it was working before
  76. (despite the lack of escaping), you'll have to change your code to "unescape" the
  77. slashes one level.
  78. For example, this used to work::
  79. # Find text containing a single backslash
  80. MyModel.objects.filter(text__contains='\\\\')
  81. The above is now incorrect, and should be rewritten as::
  82. # Find text containing a single backslash
  83. MyModel.objects.filter(text__contains='\\')
  84. Removed ENABLE_PSYCO setting
  85. ----------------------------
  86. The ``ENABLE_PSYCO`` setting no longer exists. If your settings file includes
  87. ``ENABLE_PSYCO`` it will have no effect; to use Psyco_, we recommend
  88. writing a middleware class to activate it.
  89. .. _psyco: http://psyco.sourceforge.net/
  90. What's new in 0.96?
  91. ===================
  92. This revision represents over a thousand source commits and over four hundred
  93. bug fixes, so we can't possibly catalog all the changes. Here, we describe the
  94. most notable changes in this release.
  95. New forms library
  96. -----------------
  97. ``django.newforms`` is Django's new form-handling library. It's a
  98. replacement for ``django.forms``, the old form/manipulator/validation
  99. framework. Both APIs are available in 0.96, but over the next two
  100. releases we plan to switch completely to the new forms system, and
  101. deprecate and remove the old system.
  102. There are three elements to this transition:
  103. * We've copied the current ``django.forms`` to
  104. ``django.oldforms``. This allows you to upgrade your code *now*
  105. rather than waiting for the backwards-incompatible change and
  106. rushing to fix your code after the fact. Just change your
  107. import statements like this::
  108. from django import forms # 0.95-style
  109. from django import oldforms as forms # 0.96-style
  110. * The next official release of Django will move the current
  111. ``django.newforms`` to ``django.forms``. This will be a
  112. backwards-incompatible change, and anyone still using the old
  113. version of ``django.forms`` at that time will need to change
  114. their import statements as described above.
  115. * The next release after that will completely remove
  116. ``django.oldforms``.
  117. Although the ``newforms`` library will continue to evolve, it's ready for use
  118. for most common cases. We recommend that anyone new to form handling skip the
  119. old forms system and start with the new.
  120. For more information about ``django.newforms``, read the :doc:`newforms
  121. documentation </topics/forms/index>`.
  122. URLconf improvements
  123. --------------------
  124. You can now use any callable as the callback in URLconfs (previously, only
  125. strings that referred to callables were allowed). This allows a much more
  126. natural use of URLconfs. For example, this URLconf::
  127. from django.conf.urls.defaults import *
  128. urlpatterns = patterns('',
  129. ('^myview/$', 'mysite.myapp.views.myview')
  130. )
  131. can now be rewritten as::
  132. from django.conf.urls.defaults import *
  133. from mysite.myapp.views import myview
  134. urlpatterns = patterns('',
  135. ('^myview/$', myview)
  136. )
  137. One useful application of this can be seen when using decorators; this
  138. change allows you to apply decorators to views *in your
  139. URLconf*. Thus, you can make a generic view require login very
  140. easily::
  141. from django.conf.urls.defaults import *
  142. from django.contrib.auth.decorators import login_required
  143. from django.views.generic.list_detail import object_list
  144. from mysite.myapp.models import MyModel
  145. info = {
  146. "queryset" : MyModel.objects.all(),
  147. }
  148. urlpatterns = patterns('',
  149. ('^myview/$', login_required(object_list), info)
  150. )
  151. Note that both syntaxes (strings and callables) are valid, and will continue to
  152. be valid for the foreseeable future.
  153. The test framework
  154. ------------------
  155. Django now includes a test framework so you can start transmuting fear into
  156. boredom (with apologies to Kent Beck). You can write tests based on
  157. :mod:`doctest` or :mod:`unittest` and test your views with a simple test client.
  158. There is also new support for "fixtures" -- initial data, stored in any of the
  159. supported :doc:`serialization formats </topics/serialization>`, that will be
  160. loaded into your database at the start of your tests. This makes testing with
  161. real data much easier.
  162. See :doc:`the testing documentation </topics/testing/index>` for the full details.
  163. Improvements to the admin interface
  164. -----------------------------------
  165. A small change, but a very nice one: dedicated views for adding and
  166. updating users have been added to the admin interface, so you no
  167. longer need to worry about working with hashed passwords in the admin.
  168. Thanks
  169. ======
  170. Since 0.95, a number of people have stepped forward and taken a major
  171. new role in Django's development. We'd like to thank these people for
  172. all their hard work:
  173. * Russell Keith-Magee and Malcolm Tredinnick for their major code
  174. contributions. This release wouldn't have been possible without them.
  175. * Our new release manager, James Bennett, for his work in getting out
  176. 0.95.1, 0.96, and (hopefully) future release.
  177. * Our ticket managers Chris Beaven (aka SmileyChris), Simon Greenhill,
  178. Michael Radziej, and Gary Wilson. They agreed to take on the monumental
  179. task of wrangling our tickets into nicely cataloged submission. Figuring
  180. out what to work on is now about a million times easier; thanks again,
  181. guys.
  182. * Everyone who submitted a bug report, patch or ticket comment. We can't
  183. possibly thank everyone by name -- over 200 developers submitted patches
  184. that went into 0.96 -- but everyone who's contributed to Django is listed
  185. in AUTHORS_.
  186. .. _AUTHORS: https://code.djangoproject.com/browser/django/trunk/AUTHORS