2007-03-22 23:16:53 +01:00
|
|
|
=================================
|
|
|
|
Django version 0.96 release notes
|
|
|
|
=================================
|
|
|
|
|
|
|
|
Welcome to Django 0.96!
|
|
|
|
|
|
|
|
The primary goal for 0.96 is a cleanup and stabilization of the features
|
|
|
|
introduced in 0.95. There have been a few small `backwards-incompatible
|
2007-03-23 07:25:54 +01:00
|
|
|
changes`_ since 0.95, but the upgrade process should be fairly simple
|
|
|
|
and should not require major changes to existing applications.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
|
|
|
However, we're also releasing 0.96 now because we have a set of
|
2007-03-23 07:25:54 +01:00
|
|
|
backwards-incompatible changes scheduled for the near future. Once
|
|
|
|
completed, they will involve some code changes for application
|
|
|
|
developers, so we recommend that you stick with Django 0.96 until the
|
|
|
|
next official release; then you'll be able to upgrade in one step
|
|
|
|
instead of needing to make incremental changes to keep up with the
|
|
|
|
development version of Django.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2007-03-23 21:39:59 +01:00
|
|
|
Backwards-incompatible changes
|
|
|
|
==============================
|
|
|
|
|
|
|
|
The following changes may require you to update your code when you switch from
|
|
|
|
0.95 to 0.96:
|
|
|
|
|
2007-03-23 21:42:32 +01:00
|
|
|
``MySQLdb`` version requirement
|
2007-03-23 21:43:10 +01:00
|
|
|
-------------------------------
|
2007-03-23 21:39:59 +01:00
|
|
|
|
2007-03-23 21:42:32 +01:00
|
|
|
Due to a bug in older versions of the ``MySQLdb`` Python module (which
|
2007-03-23 21:39:59 +01:00
|
|
|
Django uses to connect to MySQL databases), Django's MySQL backend now
|
2007-07-01 03:00:23 +02:00
|
|
|
requires version 1.2.1p2 or higher of ``MySQLdb``, and will raise
|
2007-03-23 21:39:59 +01:00
|
|
|
exceptions if you attempt to use an older version.
|
|
|
|
|
2007-03-23 21:42:32 +01:00
|
|
|
If you're currently unable to upgrade your copy of ``MySQLdb`` to meet
|
2007-03-23 21:39:59 +01:00
|
|
|
this requirement, a separate, backwards-compatible backend, called
|
|
|
|
"mysql_old", has been added to Django. To use this backend, change
|
2008-08-24 00:25:40 +02:00
|
|
|
the :setting:`DATABASE_ENGINE` setting in your Django settings file from
|
2007-03-23 21:39:59 +01:00
|
|
|
this::
|
|
|
|
|
|
|
|
DATABASE_ENGINE = "mysql"
|
|
|
|
|
|
|
|
to this::
|
|
|
|
|
|
|
|
DATABASE_ENGINE = "mysql_old"
|
|
|
|
|
|
|
|
However, we strongly encourage MySQL users to upgrade to a more recent
|
2007-11-29 19:15:38 +01:00
|
|
|
version of ``MySQLdb`` as soon as possible, The "mysql_old" backend is
|
2007-03-23 21:39:59 +01:00
|
|
|
provided only to ease this transition, and is considered deprecated;
|
|
|
|
aside from any necessary security fixes, it will not be actively
|
|
|
|
maintained, and it will be removed in a future release of Django.
|
|
|
|
|
2008-08-24 00:25:40 +02:00
|
|
|
Also, note that some features, like the new :setting:`DATABASE_OPTIONS`
|
2011-12-30 13:21:40 +01:00
|
|
|
setting (see the :doc:`databases documentation </ref/databases>` for details),
|
|
|
|
are only available on the "mysql" backend, and will not be made available for
|
2007-03-23 21:39:59 +01:00
|
|
|
"mysql_old".
|
|
|
|
|
|
|
|
Database constraint names changed
|
|
|
|
---------------------------------
|
|
|
|
|
|
|
|
The format of the constraint names Django generates for foreign key
|
|
|
|
references have changed slightly. These names are generally only used
|
|
|
|
when it is not possible to put the reference directly on the affected
|
2007-03-26 01:22:37 +02:00
|
|
|
column, so they are not always visible.
|
2007-03-23 21:39:59 +01:00
|
|
|
|
|
|
|
The effect of this change is that running ``manage.py reset`` and
|
|
|
|
similar commands against an existing database may generate SQL with
|
|
|
|
the new form of constraint name, while the database itself contains
|
|
|
|
constraints named in the old form; this will cause the database server
|
|
|
|
to raise an error message about modifying non-existent constraints.
|
|
|
|
|
|
|
|
If you need to work around this, there are two methods available:
|
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
1. Redirect the output of ``manage.py`` to a file, and edit the
|
|
|
|
generated SQL to use the correct constraint names before
|
|
|
|
executing it.
|
2007-03-23 21:39:59 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
2. Examine the output of ``manage.py sqlall`` to see the new-style
|
|
|
|
constraint names, and use that as a guide to rename existing
|
|
|
|
constraints in your database.
|
2007-03-23 21:39:59 +01:00
|
|
|
|
2007-03-23 21:43:44 +01:00
|
|
|
Name changes in ``manage.py``
|
|
|
|
-----------------------------
|
2007-03-23 21:39:59 +01:00
|
|
|
|
|
|
|
A few of the options to ``manage.py`` have changed with the addition of fixture
|
|
|
|
support:
|
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* There are new ``dumpdata`` and ``loaddata`` commands which, as
|
|
|
|
you might expect, will dump and load data to/from the
|
|
|
|
database. These commands can operate against any of Django's
|
|
|
|
supported serialization formats.
|
2007-03-23 21:39:59 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* The ``sqlinitialdata`` command has been renamed to ``sqlcustom`` to
|
|
|
|
emphasize that ``loaddata`` should be used for data (and ``sqlcustom`` for
|
|
|
|
other custom SQL -- views, stored procedures, etc.).
|
2009-12-22 16:18:51 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* The vestigial ``install`` command has been removed. Use ``syncdb``.
|
2007-03-23 21:39:59 +01:00
|
|
|
|
|
|
|
Backslash escaping changed
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
The Django database API now escapes backslashes given as query parameters. If
|
|
|
|
you have any database API code that matches backslashes, and it was working before
|
|
|
|
(despite the lack of escaping), you'll have to change your code to "unescape" the
|
|
|
|
slashes one level.
|
|
|
|
|
|
|
|
For example, this used to work::
|
|
|
|
|
|
|
|
# Find text containing a single backslash
|
|
|
|
MyModel.objects.filter(text__contains='\\\\')
|
|
|
|
|
|
|
|
The above is now incorrect, and should be rewritten as::
|
|
|
|
|
|
|
|
# Find text containing a single backslash
|
|
|
|
MyModel.objects.filter(text__contains='\\')
|
|
|
|
|
|
|
|
Removed ENABLE_PSYCO setting
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
The ``ENABLE_PSYCO`` setting no longer exists. If your settings file includes
|
|
|
|
``ENABLE_PSYCO`` it will have no effect; to use Psyco_, we recommend
|
|
|
|
writing a middleware class to activate it.
|
|
|
|
|
|
|
|
.. _psyco: http://psyco.sourceforge.net/
|
|
|
|
|
2007-03-22 23:16:53 +01:00
|
|
|
What's new in 0.96?
|
|
|
|
===================
|
|
|
|
|
|
|
|
This revision represents over a thousand source commits and over four hundred
|
|
|
|
bug fixes, so we can't possibly catalog all the changes. Here, we describe the
|
|
|
|
most notable changes in this release.
|
|
|
|
|
|
|
|
New forms library
|
|
|
|
-----------------
|
|
|
|
|
2007-03-23 07:25:54 +01:00
|
|
|
``django.newforms`` is Django's new form-handling library. It's a
|
|
|
|
replacement for ``django.forms``, the old form/manipulator/validation
|
|
|
|
framework. Both APIs are available in 0.96, but over the next two
|
|
|
|
releases we plan to switch completely to the new forms system, and
|
|
|
|
deprecate and remove the old system.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2007-03-23 07:25:54 +01:00
|
|
|
There are three elements to this transition:
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* We've copied the current ``django.forms`` to
|
|
|
|
``django.oldforms``. This allows you to upgrade your code *now*
|
|
|
|
rather than waiting for the backwards-incompatible change and
|
|
|
|
rushing to fix your code after the fact. Just change your
|
|
|
|
import statements like this::
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
from django import forms # 0.95-style
|
|
|
|
from django import oldforms as forms # 0.96-style
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* The next official release of Django will move the current
|
|
|
|
``django.newforms`` to ``django.forms``. This will be a
|
|
|
|
backwards-incompatible change, and anyone still using the old
|
|
|
|
version of ``django.forms`` at that time will need to change
|
|
|
|
their import statements as described above.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* The next release after that will completely remove
|
|
|
|
``django.oldforms``.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
|
|
|
Although the ``newforms`` library will continue to evolve, it's ready for use
|
|
|
|
for most common cases. We recommend that anyone new to form handling skip the
|
2007-03-23 07:25:54 +01:00
|
|
|
old forms system and start with the new.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2011-12-30 13:21:40 +01:00
|
|
|
For more information about ``django.newforms``, read the :doc:`newforms
|
|
|
|
documentation </topics/forms/index>`.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
|
|
|
URLconf improvements
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
You can now use any callable as the callback in URLconfs (previously, only
|
|
|
|
strings that referred to callables were allowed). This allows a much more
|
|
|
|
natural use of URLconfs. For example, this URLconf::
|
|
|
|
|
|
|
|
from django.conf.urls.defaults import *
|
2009-12-22 16:18:51 +01:00
|
|
|
|
|
|
|
urlpatterns = patterns('',
|
2007-03-22 23:16:53 +01:00
|
|
|
('^myview/$', 'mysite.myapp.views.myview')
|
|
|
|
)
|
2009-12-22 16:18:51 +01:00
|
|
|
|
2007-03-22 23:16:53 +01:00
|
|
|
can now be rewritten as::
|
|
|
|
|
|
|
|
from django.conf.urls.defaults import *
|
|
|
|
from mysite.myapp.views import myview
|
2009-12-22 16:18:51 +01:00
|
|
|
|
|
|
|
urlpatterns = patterns('',
|
2007-03-22 23:16:53 +01:00
|
|
|
('^myview/$', myview)
|
|
|
|
)
|
2009-12-22 16:18:51 +01:00
|
|
|
|
2007-03-23 07:25:54 +01:00
|
|
|
One useful application of this can be seen when using decorators; this
|
|
|
|
change allows you to apply decorators to views *in your
|
|
|
|
URLconf*. Thus, you can make a generic view require login very
|
|
|
|
easily::
|
2007-03-22 23:16:53 +01:00
|
|
|
|
|
|
|
from django.conf.urls.defaults import *
|
|
|
|
from django.contrib.auth.decorators import login_required
|
|
|
|
from django.views.generic.list_detail import object_list
|
|
|
|
from mysite.myapp.models import MyModel
|
2009-12-22 16:18:51 +01:00
|
|
|
|
2007-03-22 23:16:53 +01:00
|
|
|
info = {
|
|
|
|
"queryset" : MyModel.objects.all(),
|
|
|
|
}
|
2009-12-22 16:18:51 +01:00
|
|
|
|
|
|
|
urlpatterns = patterns('',
|
2007-03-22 23:16:53 +01:00
|
|
|
('^myview/$', login_required(object_list), info)
|
|
|
|
)
|
|
|
|
|
|
|
|
Note that both syntaxes (strings and callables) are valid, and will continue to
|
2009-12-22 16:18:51 +01:00
|
|
|
be valid for the foreseeable future.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
|
|
|
The test framework
|
|
|
|
------------------
|
|
|
|
|
|
|
|
Django now includes a test framework so you can start transmuting fear into
|
2011-09-04 23:17:30 +02:00
|
|
|
boredom (with apologies to Kent Beck). You can write tests based on
|
|
|
|
:mod:`doctest` or :mod:`unittest` and test your views with a simple test client.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2007-03-23 07:25:54 +01:00
|
|
|
There is also new support for "fixtures" -- initial data, stored in any of the
|
2011-12-30 13:21:40 +01:00
|
|
|
supported :doc:`serialization formats </topics/serialization>`, that will be
|
|
|
|
loaded into your database at the start of your tests. This makes testing with
|
|
|
|
real data much easier.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2011-12-30 13:21:40 +01:00
|
|
|
See :doc:`the testing documentation </topics/testing>` for the full details.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2007-03-23 07:25:54 +01:00
|
|
|
Improvements to the admin interface
|
|
|
|
-----------------------------------
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2007-03-23 07:25:54 +01:00
|
|
|
A small change, but a very nice one: dedicated views for adding and
|
|
|
|
updating users have been added to the admin interface, so you no
|
|
|
|
longer need to worry about working with hashed passwords in the admin.
|
2007-03-22 23:16:53 +01:00
|
|
|
|
|
|
|
Thanks
|
|
|
|
======
|
|
|
|
|
2007-03-23 07:25:54 +01:00
|
|
|
Since 0.95, a number of people have stepped forward and taken a major
|
|
|
|
new role in Django's development. We'd like to thank these people for
|
|
|
|
all their hard work:
|
2007-03-22 23:16:53 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* Russell Keith-Magee and Malcolm Tredinnick for their major code
|
|
|
|
contributions. This release wouldn't have been possible without them.
|
2009-12-22 16:18:51 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* Our new release manager, James Bennett, for his work in getting out
|
|
|
|
0.95.1, 0.96, and (hopefully) future release.
|
2009-12-22 16:18:51 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* Our ticket managers Chris Beaven (aka SmileyChris), Simon Greenhill,
|
|
|
|
Michael Radziej, and Gary Wilson. They agreed to take on the monumental
|
|
|
|
task of wrangling our tickets into nicely cataloged submission. Figuring
|
|
|
|
out what to work on is now about a million times easier; thanks again,
|
|
|
|
guys.
|
2009-12-22 16:18:51 +01:00
|
|
|
|
2011-10-14 02:12:01 +02:00
|
|
|
* Everyone who submitted a bug report, patch or ticket comment. We can't
|
|
|
|
possibly thank everyone by name -- over 200 developers submitted patches
|
|
|
|
that went into 0.96 -- but everyone who's contributed to Django is listed
|
|
|
|
in AUTHORS_.
|
2009-12-22 16:18:51 +01:00
|
|
|
|
2012-03-13 18:53:31 +01:00
|
|
|
.. _AUTHORS: https://code.djangoproject.com/browser/django/trunk/AUTHORS
|