Version 82 (modified by 18 years ago) ( diff ) | ,
---|
Backwards-incompatible changes
As Django is still in pre-1.0 mode, we haven't yet committed to maintaining backwards compatibility in any APIs. Although we're keeping such changes to a minimum, Django developers should be acutely aware of these changes.
Of course, once we reach 1.0, we'll be strongly committed to backward compatibility.
This page lists all backwards-incompatible changes to Django since the 0.95 release. For changes prior to 0.95, see the OlderBackwardsIncompatibleChanges page.
Table of Contents
Changes made after Django [source:/django/tags/releases/0.95 0.95]:
- August 2, 2006: Database constraint names changed
- August 11, 2006: Backslash escaping changed
- September 27, 2006: Removed ENABLE_PSYCO setting
- January 16, 2007: Changed Admin.manager option to more flexible hook
- January 28, 2007: Changed prepopulate_from to be defined in the Admin class, not database field classes
- February 25, 2007: Moved admin doc views into django.contrib.admindocs
- March 14, 2007: Enforcing MySQLdb version
Changes made after Django [source:/django/tags/releases/0.96 0.96]:
- March 31, 2007: Changed 'spaceless' template tag to remove all spaces
Database constraint names changed
As of [3512], the format of the constraint names Django generates for foreign key references changed slightly. These names are only used sometimes, when it is not possible to put the reference directly on the affected column, so this is not always visible.
The effect of this change is that manage.py reset app_name
and similar commands may generate SQL with invalid constraint names and thus generate an error when run against the database (the database server will complain about the constraint not existing). To fix this, you will need to tweak the output of manage.py sqlreset app_name
to match the correct constraint names and pass the results to the database server manually.
Backslash escaping changed
As of [3552], the Django database API now escapes backslashes given as query parameters. If you have any database API code that match backslashes, and it was working before (despite the broken escaping), you'll have to change your code to "unescape" the slashes one level.
For example, this used to work:
# Code that matches a single backslash MyModel.objects.filter(text__contains='\\\\')
But it should be rewritten as this:
# Code that matches a single backslash MyModel.objects.filter(text__contains='\\')
Removed ENABLE_PSYCO setting
As of [3877], the ENABLE_PSYCO
setting no longer exists. If your settings file includes ENABLE_PSYCO
, nothing will break per se, but it just won't do anything. If you want to use Psyco with Django, write some custom middleware that activates Psyco.
Changed Admin.manager option to more flexible hook
As of [4342], the manager
option to class Admin
no longer exists. This option was undocumented, but we're mentioning the change here in case you used it. In favor of this option, class Admin
may now define one of these methods:
queryset()
queryset_add()
queryset_change()
These give you much more flexibility.
Note that this change was made to the NewformsAdminBranch. (We initially called the new method change_list_queryset
, but this was changed in [4584] to be more flexible.) The change will not be made to trunk until that branch is merged to trunk.
Changed prepopulate_from to be defined in the Admin class, not database field classes
As of [4446], the prepopulate_from
option to database fields no longer exists. It's been discontinued in favor of the new prepopulated_fields
option on class Admin
. The new prepopulated_fields
option, if given, should be a dictionary mapping field names to lists/tuples of field names. Here's an example comparing old syntax and new syntax:
# OLD: class MyModel(models.Model): first_name = models.CharField(maxlength=30) last_name = models.CharField(maxlength=30) slug = models.CharField(maxlength=60, prepopulate_from=('first_name', 'last_name')) class Admin: pass # NEW: class MyModel(models.Model): first_name = models.CharField(maxlength=30) last_name = models.CharField(maxlength=30) slug = models.CharField(maxlength=60) class Admin: prepopulated_fields = {'slug': ('first_name', 'last_name')}
Note that this change was made to the NewformsAdminBranch. The change will not be made to trunk until that branch is merged to trunk.
Moved admin doc views into django.contrib.admindocs
As of [4585], the documentation views for the Django admin site were moved into a new package, django.contrib.admindocs
.
The admin docs, which aren't documented very well, were located at docs/
in the admin site. They're also linked-to by the "Documentation" link in the upper right of default admin templates.
Because we've moved the doc views, you now have to activate admin docs explicitly. Do this by adding the following line to your URLconf:
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
Note that this change was made to the NewformsAdminBranch. The change will not be made to trunk until that branch is merged to trunk.
Enforcing MySQLdb version
As of [4724], Django raises an error if you try to use the MySQL backend with a MySQLdb
(MySQL Python module) version earlier than 1.2.1p2. There were significant, production-related bugs in earlier versions, so we have upgraded the minimum requirement.
In [4767], we added a mysql_old
backend, which is identical to the mysql
backend prior to the change in [4724]. You can use this backend if upgrading the MySQLdb
module is not immediately possible. However, the mysql_old
backend is deprecated, and we will not continue developing it.
Changed 'spaceless' template tag to remove all spaces
As of [4885], the spaceless
template tag removes *all* spaces between HTML tags instead of preserving a single space.
For example, for this template code:
{% spaceless %} <p> <a href="foo/">Foo</a> </p> {% endspaceless %}
The old output was this:
<p> <a href="foo/">Foo</a> </p>
The new output is this:
<p><a href="foo/">Foo</a></p>
As always, spaceless
only affects space *between* HTML tags, not space within HTML tags or space in plain text.