| 1 |
0.96 -> 1.0
|
| 2 |
===========
|
| 3 |
|
| 4 |
Django 1.0 has a number of backwards-incompatible changes from Django
|
| 5 |
0.96. If you have apps written against Django 0.96 that you need to port,
|
| 6 |
see the detailed porting guide:
|
| 7 |
/usr/share/doc/python-django/html/releases/1.0-porting-guide.html
|
| 8 |
or
|
| 9 |
http://docs.djangoproject.com/en/dev/releases/1.0-porting-guide/
|
| 10 |
|
| 11 |
You can also find a complete list of of backwards incompatible changes
|
| 12 |
here:
|
| 13 |
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
|
| 14 |
|
| 15 |
0.95 -> 0.96
|
| 16 |
============
|
| 17 |
|
| 18 |
Information here has been gathered from:
|
| 19 |
http://www.djangoproject.com/documentation/release_notes_0.96/
|
| 20 |
and
|
| 21 |
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges
|
| 22 |
|
| 23 |
Backwards Incompatible Changes
|
| 24 |
------------------------------
|
| 25 |
|
| 26 |
Database constraint names changed
|
| 27 |
=================================
|
| 28 |
|
| 29 |
As of [3512], the format of the constraint names Django generates for
|
| 30 |
foreign key references changed slightly. These names are only used
|
| 31 |
sometimes, when it is not possible to put the reference directly on the
|
| 32 |
affected column, so this is not always visible.
|
| 33 |
|
| 34 |
The effect of this change is that manage.py reset app_name and similar
|
| 35 |
commands may generate SQL with invalid constraint names and thus generate
|
| 36 |
an error when run against the database (the database server will complain
|
| 37 |
about the constraint not existing). To fix this, you will need to tweak the
|
| 38 |
output of manage.py sqlreset app_name to match the correct constraint names
|
| 39 |
and pass the results to the database server manually.
|
| 40 |
|
| 41 |
Backslash escaping changed
|
| 42 |
==========================
|
| 43 |
|
| 44 |
As of [3552], the Django database API now escapes backslashes given as
|
| 45 |
query parameters. If you have any database API code that match backslashes,
|
| 46 |
and it was working before (despite the broken escaping), you'll have to
|
| 47 |
change your code to "unescape" the slashes one level.
|
| 48 |
|
| 49 |
For example, this used to work:
|
| 50 |
|
| 51 |
# Code that matches a single backslash
|
| 52 |
MyModel.objects.filter(text__contains='\\\\')
|
| 53 |
|
| 54 |
But it should be rewritten as this:
|
| 55 |
|
| 56 |
# Code that matches a single backslash
|
| 57 |
MyModel.objects.filter(text__contains='\\')
|
| 58 |
|
| 59 |
Removed ENABLE_PSYCO setting
|
| 60 |
============================
|
| 61 |
|
| 62 |
As of [3877], the ENABLE_PSYCO setting no longer exists. If your settings
|
| 63 |
file includes ENABLE_PSYCO, nothing will break per se, but it just won't do
|
| 64 |
anything. If you want to use Psyco with Django, write some custom
|
| 65 |
middleware that activates Psyco.
|
| 66 |
|
| 67 |
Changed Admin.manager option to more flexible hook
|
| 68 |
==================================================
|
| 69 |
|
| 70 |
As of [4342], the manager option to class Admin no longer exists. This
|
| 71 |
option was undocumented, but we're mentioning the change here in case you
|
| 72 |
used it. In favor of this option, class Admin may now define one of these
|
| 73 |
methods:
|
| 74 |
|
| 75 |
* queryset()
|
| 76 |
* queryset_add()
|
| 77 |
* queryset_change()
|
| 78 |
|
| 79 |
These give you much more flexibility.
|
| 80 |
|
| 81 |
Note that this change was made to the NewformsAdminBranch. (We initially
|
| 82 |
called the new method change_list_queryset, but this was changed in [4584]
|
| 83 |
to be more flexible.) The change will not be made to trunk until that
|
| 84 |
branch is merged to trunk.
|
| 85 |
|
| 86 |
Changed prepopulate_from to be defined in the Admin class,
|
| 87 |
not database field classes ΒΆ
|
| 88 |
==========================================================
|
| 89 |
|
| 90 |
As of [4446], the prepopulate_from option to database fields no
|
| 91 |
longer exists. It's been discontinued in favor of the new
|
| 92 |
prepopulated_fields option on class Admin. The new
|
| 93 |
prepopulated_fields option, if given, should be a dictionary
|
| 94 |
mapping field names to lists/tuples of field names. Here's an
|
| 95 |
example comparing old syntax and new syntax:
|
| 96 |
|
| 97 |
# OLD:
|
| 98 |
class MyModel(models.Model):
|
| 99 |
first_name = models.CharField(maxlength=30)
|
| 100 |
last_name = models.CharField(maxlength=30)
|
| 101 |
slug = models.CharField(maxlength=60, prepopulate_from=('first_name', 'last_name'))
|
| 102 |
|
| 103 |
class Admin:
|
| 104 |
pass
|
| 105 |
|
| 106 |
# NEW:
|
| 107 |
class MyModel(models.Model):
|
| 108 |
first_name = models.CharField(maxlength=30)
|
| 109 |
last_name = models.CharField(maxlength=30)
|
| 110 |
slug = models.CharField(maxlength=60)
|
| 111 |
|
| 112 |
class Admin:
|
| 113 |
prepopulated_fields = {'slug': ('first_name', 'last_name')}
|
| 114 |
|
| 115 |
Moved admin doc views into django.contrib.admindocs
|
| 116 |
====================================================
|
| 117 |
|
| 118 |
As of [4585], the documentation views for the Django admin site were moved
|
| 119 |
into a new package, django.contrib.admindocs.
|
| 120 |
|
| 121 |
The admin docs, which aren't documented very well, were located at docs/ in
|
| 122 |
the admin site. They're also linked-to by the "Documentation" link in the
|
| 123 |
upper right of default admin templates.
|
| 124 |
|
| 125 |
Because we've moved the doc views, you now have to activate admin docs
|
| 126 |
explicitly. Do this by adding the following line to your URLconf:
|
| 127 |
|
| 128 |
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
| 129 |
|
| 130 |
Note that this change was made to the NewformsAdminBranch. The change will
|
| 131 |
not be made to trunk until that branch is merged to trunk.
|
| 132 |
|
| 133 |
Enforcing MySQLdb version
|
| 134 |
=========================
|
| 135 |
|
| 136 |
As of [4724], Django will raise an error if you try to use the MySQL
|
| 137 |
backend with a MySQLdb ( MySQL python module) version earlier than 1.2.1p2.
|
| 138 |
There were significant, production-related bugs in earlier versions, so we
|
| 139 |
have upgraded the minimum requirement.
|
| 140 |
|
| 141 |
In [4767], a mysql_old backend was added, that is identical to the original
|
| 142 |
mysql backend prior to the change in [4724]. This backend can be used if
|
| 143 |
upgrading the MySQLdb module is not immediately possible, however, it is
|
| 144 |
deprecated and no further development will be done on it.
|
| 145 |
|
| 146 |
New Features
|
| 147 |
------------
|
| 148 |
|
| 149 |
New forms library
|
| 150 |
=================
|
| 151 |
|
| 152 |
The new forms library has been merged from the new forms branch in to
|
| 153 |
django.newforms in 0.96, the next revision will replace django.forms with
|
| 154 |
django.newforms, the current forms library is already copied to
|
| 155 |
django.oldforms to make the transition easier - it's advised to either
|
| 156 |
upgrade your forms code to the newforms library or to change your imports
|
| 157 |
as follows:
|
| 158 |
|
| 159 |
from django import forms
|
| 160 |
becomes
|
| 161 |
from django import oldforms as forms
|
| 162 |
|
| 163 |
URLconf improvements
|
| 164 |
====================
|
| 165 |
|
| 166 |
It's now possible to use imported views in the urlconf rather than a string
|
| 167 |
representing the view to call.
|
| 168 |
|
| 169 |
Test framework
|
| 170 |
==============
|
| 171 |
|
| 172 |
Now possible to write tests based on doctest and unittest
|
| 173 |
|
| 174 |
Admin area changes
|
| 175 |
==================
|
| 176 |
|
| 177 |
Changes to the user adding and updating views so that you don't need to
|
| 178 |
worry about hashed passwords.
|