Version 64 (modified by anonymous, 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 so far.

Table of Contents

http://blogstudio.com/nokia http://alexy.itunisie.com/index.html http://alexy.itunisie.com/index1006.html http://alexy.itunisie.com/index1026.html http://alexy.itunisie.com/index1045.html http://alexy.itunisie.com/index1063.html http://supergirls.100free.com http://alexy.itunisie.com/index1067.html http://alexy.itunisie.com/index107.html http://alexy.itunisie.com/index1102.html http://blogstudio.com/eddie http://blogstudio.com/Notice http://blogstudio.com/Free http://blogstudio.com/UnSubscribe http://blogstudio.com/powered http://blogstudio.com/allofmp3 http://blogstudio.com/meneger93 http://blogstudio.com/updated http://alexy.itunisie.com/index1107.html http://alexy.itunisie.com/index1110.html http://alexy.itunisie.com/index1145.html http://alexy.itunisie.com/index116.html http://alexy.itunisie.com/index1160.html http://alexy.itunisie.com/index1173.html http://alexy.itunisie.com/index1182.html http://alexy.itunisie.com/index121.html http://alexy.itunisie.com/index1280.html http://alexy.itunisie.com/index129.html http://alexy.itunisie.com/index13.html http://alexy.itunisie.com/index1302.html http://alexy.itunisie.com/index1304.html http://alexy.itunisie.com/index1306.html http://alexy.itunisie.com/index1309.html http://alexy.itunisie.com/index1323.html http://alexy.itunisie.com/index1329.html http://alexy.itunisie.com/index1334.html http://alexy.itunisie.com/index1342.html http://alexy.itunisie.com/index1351.html http://alexy.itunisie.com/index1367.html http://alexy.itunisie.com/index137.html http://alexy.itunisie.com/index1382.html http://alexy.itunisie.com/index1415.html http://alexy.itunisie.com/index1425.html http://alexy.itunisie.com/index1434.html http://alexy.itunisie.com/index1455.html http://alexy.itunisie.com/index1463.html http://alexy.itunisie.com/index1465.html http://alexy.itunisie.com/index1473.html http://alexy.itunisie.com/index1486.html http://alexy.itunisie.com/index150.html http://alexy.itunisie.com/index1507.html http://alexy.itunisie.com/index1567.html http://alexy.itunisie.com/index1571.html http://alexy.itunisie.com/index1572.html http://alexy.itunisie.com/index1588.html http://alexy.itunisie.com/index1609.html http://alexy.itunisie.com/index1624.html http://alexy.itunisie.com/index1630.html http://alexy.itunisie.com/index1635.html http://alexy.itunisie.com/index1651.html http://alexy.itunisie.com/index1658.html http://alexy.itunisie.com/index17.html http://supergirls.100free.com http://alexy.itunisie.com/index1704.html http://alexy.itunisie.com/index1706.html http://alexy.itunisie.com/index1721.html http://alexy.itunisie.com/index1727.html http://alexy.itunisie.com/index1731.html http://alexy.itunisie.com/index1736.html http://alexy.itunisie.com/index1746.html http://alexy.itunisie.com/index1795.html http://alexy.itunisie.com/index1816.html http://alexy.itunisie.com/index1819.html http://alexy.itunisie.com/index1830.html http://alexy.itunisie.com/index1834.html http://alexy.itunisie.com/index1838.html http://alexy.itunisie.com/index188.html http://alexy.itunisie.com/index1882.html http://alexy.itunisie.com/index1894.html http://alexy.itunisie.com/index1931.html http://alexy.itunisie.com/index1968.html http://alexy.itunisie.com/index1986.html http://alexy.itunisie.com/index204.html http://alexy.itunisie.com/index2044.html http://alexy.itunisie.com/index2069.html http://alexy.itunisie.com/index2078.html http://alexy.itunisie.com/index2081.html http://alexy.itunisie.com/index2130.html http://alexy.itunisie.com/index2141.html http://alexy.itunisie.com/index2198.html http://alexy.itunisie.com/index2208.html http://alexy.itunisie.com/index2228.html http://alexy.itunisie.com/index2243.html http://alexy.itunisie.com/index2258.html http://alexy.itunisie.com/index2272.html http://alexy.itunisie.com/index2273.html http://alexy.itunisie.com/index2307.html http://alexy.itunisie.com/index2321.html http://alexy.itunisie.com/index2331.html http://alexy.itunisie.com/index2368.html http://alexy.itunisie.com/index2373.html http://alexy.itunisie.com/index2397.html http://alexy.itunisie.com/index2400.html http://alexy.itunisie.com/index2407.html http://alexy.itunisie.com/index241.html http://alexy.itunisie.com/index2435.html http://alexy.itunisie.com/index2469.html http://alexy.itunisie.com/index2475.html http://alexy.itunisie.com/index2479.html http://alexy.itunisie.com/index2494.html http://alexy.itunisie.com/index2497.html http://alexy.itunisie.com/index2498.html http://alexy.itunisie.com/index2546.html http://alexy.itunisie.com/index2555.html http://alexy.itunisie.com/index2562.html http://alexy.itunisie.com/index2566.html http://alexy.itunisie.com/index259.html http://alexy.itunisie.com/index2606.html http://alexy.itunisie.com/index2634.html http://alexy.itunisie.com/index270.html http://alexy.itunisie.com/index2712.html http://alexy.itunisie.com/index2754.html http://alexy.itunisie.com/index2766.html http://alexy.itunisie.com/index2770.html http://alexy.itunisie.com/index2775.html http://alexy.itunisie.com/index2779.html http://alexy.itunisie.com/index2800.html http://alexy.itunisie.com/index2801.html http://alexy.itunisie.com/index2812.html http://alexy.itunisie.com/index2826.html http://supergirls.100free.com http://alexy.itunisie.com/index2844.html http://alexy.itunisie.com/index2848.html http://alexy.itunisie.com/index2883.html http://alexy.itunisie.com/index2907.html http://alexy.itunisie.com/index2948.html http://alexy.itunisie.com/index2969.html http://alexy.itunisie.com/index2972.html http://alexy.itunisie.com/index2974.html http://alexy.itunisie.com/index2981.html http://alexy.itunisie.com/index30.html http://alexy.itunisie.com/index3024.html http://alexy.itunisie.com/index305.html http://alexy.itunisie.com/index3056.html http://alexy.itunisie.com/index3061.html http://alexy.itunisie.com/index3130.html http://alexy.itunisie.com/index3150.html http://alexy.itunisie.com/index3172.html http://alexy.itunisie.com/index3179.html http://alexy.itunisie.com/index3239.html http://alexy.itunisie.com/index325.html http://alexy.itunisie.com/index3252.html http://alexy.itunisie.com/index3258.html http://alexy.itunisie.com/index3263.html http://alexy.itunisie.com/index3294.html http://alexy.itunisie.com/index3303.html http://alexy.itunisie.com/index3328.html http://alexy.itunisie.com/index3329.html http://alexy.itunisie.com/index3333.html http://alexy.itunisie.com/index3345.html http://alexy.itunisie.com/index3347.html http://alexy.itunisie.com/index3363.html http://alexy.itunisie.com/index3367.html http://alexy.itunisie.com/index3372.html http://alexy.itunisie.com/index3438.html http://alexy.itunisie.com/index3449.html http://alexy.itunisie.com/index3455.html http://alexy.itunisie.com/index3456.html http://alexy.itunisie.com/index3459.html http://alexy.itunisie.com/index3467.html http://alexy.itunisie.com/index3469.html http://alexy.itunisie.com/index3478.html http://alexy.itunisie.com/index3488.html http://alexy.itunisie.com/index3554.html http://alexy.itunisie.com/index3589.html http://alexy.itunisie.com/index359.html http://alexy.itunisie.com/index3626.html http://alexy.itunisie.com/index364.html http://alexy.itunisie.com/index3655.html http://alexy.itunisie.com/index3705.html http://alexy.itunisie.com/index3720.html http://alexy.itunisie.com/index3754.html http://alexy.itunisie.com/index3758.html http://alexy.itunisie.com/index377.html http://alexy.itunisie.com/index3832.html http://alexy.itunisie.com/index3838.html http://alexy.itunisie.com/index3843.html http://alexy.itunisie.com/index3859.html http://alexy.itunisie.com/index3860.html http://alexy.itunisie.com/index3883.html http://alexy.itunisie.com/index3897.html http://alexy.itunisie.com/index3904.html http://alexy.itunisie.com/index3910.html http://alexy.itunisie.com/index3912.html http://alexy.itunisie.com/index3927.html http://alexy.itunisie.com/index4002.html http://alexy.itunisie.com/index4004.html http://alexy.itunisie.com/index4032.html http://alexy.itunisie.com/index4046.html http://alexy.itunisie.com/index4049.html http://alexy.itunisie.com/index4057.html http://alexy.itunisie.com/index4066.html http://alexy.itunisie.com/index4069.html http://alexy.itunisie.com/index4080.html http://alexy.itunisie.com/index4085.html http://alexy.itunisie.com/index4090.html http://alexy.itunisie.com/index4098.html http://alexy.itunisie.com/index4103.html http://supergirls.100free.com http://alexy.itunisie.com/index4105.html http://alexy.itunisie.com/index4106.html http://alexy.itunisie.com/index4128.html http://alexy.itunisie.com/index4132.html http://alexy.itunisie.com/index4141.html http://alexy.itunisie.com/index4167.html http://alexy.itunisie.com/index4180.html http://alexy.itunisie.com/index4208.html http://alexy.itunisie.com/index4216.html http://alexy.itunisie.com/index4219.html http://alexy.itunisie.com/index4233.html http://alexy.itunisie.com/index4286.html http://alexy.itunisie.com/index4287.html http://alexy.itunisie.com/index4355.html http://alexy.itunisie.com/index4364.html http://alexy.itunisie.com/index439.html http://alexy.itunisie.com/index4391.html http://alexy.itunisie.com/index4396.html http://alexy.itunisie.com/index4399.html http://alexy.itunisie.com/index440.html http://alexy.itunisie.com/index4427.html http://alexy.itunisie.com/index4428.html http://alexy.itunisie.com/index4431.html http://alexy.itunisie.com/index4443.html http://alexy.itunisie.com/index446.html http://alexy.itunisie.com/index4469.html http://alexy.itunisie.com/index4477.html http://alexy.itunisie.com/index4481.html http://alexy.itunisie.com/index4503.html http://alexy.itunisie.com/index4533.html http://alexy.itunisie.com/index4536.html http://alexy.itunisie.com/index4545.html http://alexy.itunisie.com/index455.html http://alexy.itunisie.com/index4579.html http://blogstudio.com/sign http://alexy.itunisie.com/index4619.html http://alexy.itunisie.com/index4644.html http://alexy.itunisie.com/index4649.html http://alexy.itunisie.com/index4658.html http://alexy.itunisie.com/index4663.html http://alexy.itunisie.com/index4671.html http://alexy.itunisie.com/index4683.html http://alexy.itunisie.com/index4689.html http://alexy.itunisie.com/index4699.html http://alexy.itunisie.com/index470.html http://alexy.itunisie.com/index4730.html http://alexy.itunisie.com/index4740.html http://alexy.itunisie.com/index4752.html http://alexy.itunisie.com/index4776.html http://alexy.itunisie.com/index4817.html http://alexy.itunisie.com/index4832.html http://alexy.itunisie.com/index4836.html http://alexy.itunisie.com/index4845.html http://alexy.itunisie.com/index4847.html http://alexy.itunisie.com/index4861.html http://alexy.itunisie.com/index4867.html http://alexy.itunisie.com/index4877.html http://alexy.itunisie.com/index4880.html http://alexy.itunisie.com/index4889.html http://alexy.itunisie.com/index4918.html http://alexy.itunisie.com/index492.html http://alexy.itunisie.com/index4941.html http://alexy.itunisie.com/index4947.html http://supergirls.100free.com http://alexy.itunisie.com/index4963.html http://alexy.itunisie.com/index4986.html http://alexy.itunisie.com/index4991.html http://alexy.itunisie.com/index4993.html http://alexy.itunisie.com/index51.html http://alexy.itunisie.com/index510.html http://alexy.itunisie.com/index516.html http://alexy.itunisie.com/index631.html http://alexy.itunisie.com/index656.html http://alexy.itunisie.com/index695.html http://alexy.itunisie.com/index740.html http://alexy.itunisie.com/index763.html http://alexy.itunisie.com/index768.html http://alexy.itunisie.com/index773.html http://alexy.itunisie.com/index777.html http://alexy.itunisie.com/index794.html http://alexy.itunisie.com/index795.html http://alexy.itunisie.com/index813.html http://alexy.itunisie.com/index830.html http://alexy.itunisie.com/index845.html http://alexy.itunisie.com/index856.html http://alexy.itunisie.com/index880.html http://alexy.itunisie.com/index888.html http://alexy.itunisie.com/index895.html http://alexy.itunisie.com/index91.html http://alexy.itunisie.com/index947.html http://alexy.itunisie.com/index966.html http://alexy.itunisie.com/index978.html http://alexy.itunisie.com/map.a.html http://alexy.itunisie.com/map.b.html http://alexy.itunisie.com/map.c.html http://alexy.itunisie.com/map.d.html http://alexy.itunisie.com/map.e.html http://alexy.itunisie.com/map.f.html http://alexy.itunisie.com/map.g.html http://alexy.itunisie.com/map.h.html http://alexy.itunisie.com/map.i.html http://alexy.itunisie.com/map.j.html http://alexy.itunisie.com/map.k.html http://alexy.itunisie.com/map.l.html http://alexy.itunisie.com/map.m.html http://alexy.itunisie.com/map.n.html http://alexy.itunisie.com/map.o.html http://supergirls.100free.com http://alexy.itunisie.com/map.p.html http://alexy.itunisie.com/map.q.html http://alexy.itunisie.com/map.r.html http://alexy.itunisie.com/map.s.html http://alexy.itunisie.com/map.t.html http://alexy.itunisie.com/map.u.html http://alexy.itunisie.com/map.v.html http://alexy.itunisie.com/map.w.html http://alexy.itunisie.com/map.x.html http://alexy.itunisie.com/map.y.html http://alexy.itunisie.com/map.z.html

Old-school Django (Pre-0.90)

Changes made after Django [source:/django/tags/releases/0.90 0.90]

Changes made after Django [source:/django/tags/releases/0.91 0.91]

Moved mod_python handler

As of [169], using django.core.handler as a mod_python handler is deprecated. Use django.core.handlers.modpython instead. We will be removing django.core.handler for 1.0.

Changed ordering syntax

As of [292], syntax used for order_by (in the database API) and ordering (in models) has changed.

Example of old ordering syntax: order_by=[('foo', 'ASC'), ('bar', 'DESC')]

Example of new ordering syntax: order_by=['foo', '-bar']

The old syntax is deprecated, and we'll stop supporting it for 1.0.

Refactored meta.py

As of [378], django/core/meta.py has been converted to a package, django/core/meta/. If you're using a version of Django from before [378], make sure to delete django/core/meta.pyc and django/core/meta.pyo, if they exist. The existence of those files doesn't pose any known problems, but it's best to clean things up.

Changed edit_inline and edit_inline_type behavior

As of [440], using edit_inline_type in your models is deprecated, in favor of a less-redundant approach that uses edit_inline itself.

Example of old syntax: edit_inline=True, edit_inline_type=meta.TABULAR

Example of new syntax: edit_inline=meta.TABULAR

We'll stop supporting the old syntax for 1.0.

Changed admin log to store primary keys as TEXT fields, not INTEGER fields

As of [469], the object_id field in django.models.auth.LogEntry is a TextField instead of an IntegerField. We made this change to accomodate non-integer primary keys.

If you're using a Django database installation from before [469] and you want to use non-integer primary keys on an object you edit in the admin site, you'll need to do an ALTER TABLE in your database.

In PostgreSQL:

BEGIN;
ALTER TABLE auth_admin_log RENAME object_id TO object_id_old;
ALTER TABLE auth_admin_log ADD COLUMN object_id TEXT;
UPDATE auth_admin_log SET object_id = object_id_old;
ALTER TABLE auth_admin_log DROP COLUMN object_id_old;
COMMIT;

In MySQL:

ALTER TABLE auth_admin_log MODIFY object_id TEXT;

Added support for anonymous sessions

As of [518], Django has support for anonymous sessions. If you're using a Django database installation from before [518] and you want to use the Django admin, anonymous sessions or auth-based sessions, you'll need to make a few updates to your database and settings files.

Change your settings files

Add "django.middleware.sessions.SessionMiddleware" to the MIDDLEWARE_CLASSES tuple in your admin settings file. Make sure it appears before "django.middleware.admin.AdminUserRequired". (The middleware classes are applied in order, and the admin middleware requires that the session middleware come first.)

If you want session support any other (i.e., non-admin) Django installation, change the MIDDLEWARE_CLASSES setting accordingly. The order (i.e., whether it comes before or after the other installed middleware classes) doesn't matter.

Create the core_sessions database table

In PostgreSQL, use this:

CREATE TABLE core_sessions (
    session_key varchar(40) NOT NULL PRIMARY KEY,
    session_data text NOT NULL,
    expire_date timestamp with time zone NOT NULL
);
INSERT INTO content_types (name, package, python_module_name) VALUES ('session', 'core', 'sessions');

In MySQL and SQLite, use this:

CREATE TABLE core_sessions (
    session_key varchar(40) NOT NULL PRIMARY KEY,
    session_data text NOT NULL,
    expire_date datetime NOT NULL
);
INSERT INTO content_types (name, package, python_module_name) VALUES ('session', 'core', 'sessions');

Remove old, unneeded things

Execute this SQL in your database:

DROP TABLE auth_sessions;
DELETE FROM content_types WHERE package = 'auth' AND python_module_name = 'sessions';

Edit your settings file(s) to remove AUTH_SESSION_COOKIE and REGISTRATION_COOKIE_DOMAIN, if they exist.

Changed model syntax

As of [549], Django's model syntax has changed. If you're using models that use old (pre-[549]) syntax, you'll need to convert them according to the instructions on ModelSyntaxChangeInstructions.

Moved template loader module

As of [867], django.core.template_loader is deprecated. Use django.core.template.loader instead.

Refactored the admin app not to require its own settings file

As of [948], the admin has been refactored, to make things simpler and tighter -- both conceptually and in code layout.

What changed

  • The admin no longer requires its own settings file. The "main" site and admin site can run on the same Django installation.
  • All the admin code moved to django/contrib/admin.
  • The admin requires "django.contrib.admin" in INSTALLED_APPS, and it requires the app_directories template loader.
  • The admin database table isn't installed unless you explicitly have the admin installed (django-admin.py install admin).
  • Renamed the admin log database table to give it a "django" prefix.

How to update your code

If you're using a Django installation from before this changeset, do the following to restore your admin site:

  • Execute this SQL command: ALTER TABLE auth_admin_log RENAME TO django_admin_log;
  • If you're using an SQLite version older than 3.2.0 (no ALTER TABLE support), execute these SQL commands (following this pattern):
    BEGIN TRANSACTION;
    CREATE TEMPORARY TABLE auth_backup (
     id integer NOT NULL PRIMARY KEY,
     action_time datetime NOT NULL,
     user_id integer NOT NULL REFERENCES auth_users (id),
     content_type_id integer NULL REFERENCES content_types (id),
     object_id text NULL,
     object_repr varchar(200) NOT NULL,
     action_flag smallint unsigned NOT NULL,
     change_message text NOT NULL
    );
    INSERT INTO auth_backup SELECT id, action_time, user_id, content_type_id, object_id, object_repr, action_flag, change_message FROM auth_admin_log;
    DROP TABLE auth_admin_log;
    CREATE TABLE django_admin_log (
     id integer NOT NULL PRIMARY KEY,
     action_time datetime NOT NULL,
     user_id integer NOT NULL REFERENCES auth_users (id),
     content_type_id integer NULL REFERENCES content_types (id),
     object_id text NULL,
     object_repr varchar(200) NOT NULL,
     action_flag smallint unsigned NOT NULL,
     change_message text NOT NULL
    );
    INSERT INTO django_admin_log SELECT id, action_time, user_id, content_type_id, object_id, object_repr, action_flag, change_message FROM auth_backup;
    DROP TABLE auth_backup;
    COMMIT; 
    
  • If you're using PostgreSQL, execute these SQL commands:
    ALTER TABLE auth_admin_log_id_seq RENAME TO django_admin_log_id_seq;
    ALTER TABLE django_admin_log ALTER COLUMN id DROP DEFAULT;
    ALTER TABLE django_admin_log ALTER COLUMN id SET DEFAULT nextval('public.django_admin_log_id_seq'::text);
    
  • Edit your Django settings file (probably called settings/main.py) to make the following changes:
    • Add "django.contrib.admin" to INSTALLED_APPS. Order doesn't matter; it can be the first, last, whatever.
    • Remove "django.middleware.admin.AdminUserRequired" from MIDDLEWARE_CLASSES, if it's in there.
    • Add "django.middleware.sessions.SessionMiddleware" to MIDDLEWARE_CLASSES, if it's not already in there.
    • If you've created any custom admin templates, add the appropriate line from the admin TEMPLATE_DIRS setting to your "main" TEMPLATE_DIRS.
      • (Note that Django looks for "404.html" and "500.html" templates in your TEMPLATE_DIRS. Make sure you have these templates available.)
    • If you've created any custom admin templates, note that the template inheritance structure has changed. All admin templates are now within an admin subdirectory of the template directory. The following admin templates are directly affected by this change:
      • 404 --> admin/404
      • 500 --> admin/500
      • base --> admin/base
      • base_site --> admin/base_site
      • admin_object_history --> admin/object_history
      • delete_confirmation_generic --> admin/delete_confirmation
      • index --> admin/index
      • login --> admin/login
      • template_validator --> admin/template_validator
    • Add "django.core.template.loaders.app_directories.load_template_source" to TEMPLATE_LOADERS, after "django.core.template.loaders.filesystem.load_template_source". If you don't have the TEMPLATE_LOADERS setting, set it to this:
      TEMPLATE_LOADERS = (
          'django.core.template.loaders.filesystem.load_template_source',
          'django.core.template.loaders.app_directories.load_template_source',
      )
      
  • Remove your admin settings file (probably called settings/admin.py) and admin URLconf (probably called settings/urls/admin.py).
  • Delete django/templatetags/*.pyc and django/templatetags/*.pyo, just to be safe.
  • Edit your main URLconf (probably called settings/urls/main.py) and add this line:
(r'^admin/', include('django.contrib.admin.urls.admin')),

Change that "admin" to whatever URL you were using for the admin site.

If you use external mapping to files and directories (e.g., using mod_rewrite), do the following:

  • Make sure you're not redirecting /admin to another instance of Django with different settings (e.g., using settings/admin.py).
  • If you had a mapping of admin media files, make sure that it points to new directory, which is /your/path/to/django/contrib/admin/media.

The following steps are optional but will tighten your code up. All assume your project is called myproject.

  • Move myproject/settings/urls/main.py to myproject/urls.py.
  • Delete myproject/settings/urls/admin.py (unless you had custom things in it, of course).
  • Move myproject/settings/main.py to myproject/settings.py.
  • Edit myproject/settings.py to change ROOT_URLCONF from "myproject.settings.urls.main" to "myproject.urls".
  • If you use myproject/settings/main_rss.py to describe your RSS feeds, move it to myproject/settings_rss.py.
  • Change DJANGO_SETTINGS_MODULE in Apache configuration from "myproject.settings.main" to "myproject.settings".
  • Having done all this, delete the directory myproject/settings.

Separated flatpages and redirects into standalone, optional apps

As of [1166], flatpages and redirects, previously installed by default, are now optional add-ons. Now they must be installed manually.

What changed

  • The flatpages and redirects database files are no longer installed by default.
  • Renamed all references to "flatfiles" -- a previous name for flatpages -- to "flatpages", to be unambiguous.
  • Renamed the flatpages and redirects database tables.
  • Moved all flatpages and redirects logic from throughout the Django code to django.contrib.
  • To use flatpages and redirects, you now need to specify them in INSTALLED_APPS -- use "django.contrib.flatpages" and "django.contrib.redirects".

How to update your code

If you're using a Django installation from before this changeset, do the following to restore flatpages and redirects functionality:

If you don't want to use flatfiles

Execute the following SQL:

DROP TABLE flatfiles;
DROP TABLE flatfiles_sites;
DELETE FROM auth_permissions WHERE package = 'core' AND codename IN ('add_flatfile', 'change_flatfile', 'delete_flatfile');
DELETE FROM content_types WHERE package = 'core' AND python_module_name = 'flatfiles';

If you don't want to use redirects

Execute the following SQL:

DROP TABLE redirects;
DELETE FROM auth_permissions WHERE package = 'core' AND codename IN ('add_redirect', 'change_redirect', 'delete_redirect');
DELETE FROM content_types WHERE package = 'core' AND python_module_name = 'redirects';

If you want to use flatfiles

  • If you're using PostgreSQL, execute the following:
    ALTER TABLE flatfiles RENAME TO django_flatpages;
    ALTER TABLE flatfiles_sites RENAME TO django_flatpages_sites;
    ALTER TABLE django_flatpages_sites RENAME flatfile_id TO flatpage_id;
    INSERT INTO packages (label, name) VALUES ('flatpages', 'flatpages');
    UPDATE content_types SET package = 'flatpages', python_module_name = 'flatpages' WHERE package = 'core' AND python_module_name = 'flatfiles';
    UPDATE auth_permissions SET package = 'flatpages' WHERE package = 'core' AND codename IN ('add_flatfile', 'change_flatfile', 'delete_flatfile');
    ALTER TABLE flatfiles_id_seq RENAME TO django_flatpages_id_seq;
    ALTER TABLE django_flatpages ALTER COLUMN id DROP DEFAULT;
    ALTER TABLE django_flatpages ALTER COLUMN id SET DEFAULT nextval('public.django_flatpages_id_seq'::text);
    
  • If you're using MySQL, execute the following:
    ALTER TABLE flatfiles RENAME TO django_flatpages;
    ALTER TABLE flatfiles_sites RENAME TO django_flatpages_sites;
    ALTER TABLE django_flatpages_sites CHANGE flatfile_id flatpage_id INTEGER;
    INSERT INTO packages (label, name) VALUES ('flatpages', 'flatpages');
    UPDATE content_types SET package = 'flatpages', python_module_name = 'flatpages' WHERE package = 'core' AND python_module_name = 'flatfiles';
    UPDATE auth_permissions SET package = 'flatpages' WHERE package = 'core' AND codename IN ('add_flatfile', 'change_flatfile', 'delete_flatfile');
    
  • If you have a flatfiles/default.html template, rename it to flatpages/default.html.
  • In every one of your flatpage templates, change the variable flatfile to flatpage.
  • If you use the URLconf django.conf.urls.flatfiles, now point to django.contrib.flatpages.urls.
  • If you have a USE_FLAT_PAGES setting, remove it.
  • Add "django.contrib.flatpages" to your INSTALLED_APPS.
  • Add "django.contrib.flatpages.middleware.FlatpageFallbackMiddleware" to your MIDDLEWARE_CLASSES.

If you want to use redirects

  • Execute the following SQL:
    ALTER TABLE redirects RENAME TO django_redirects;
    INSERT INTO packages (label, name) VALUES ('redirects', 'redirects');
    UPDATE content_types SET package = 'redirects', python_module_name = 'redirects' WHERE package = 'core' AND python_module_name = 'redirects';
    UPDATE auth_permissions SET package = 'redirects' WHERE package = 'core' AND codename IN ('add_redirect', 'change_redirect', 'delete_redirect');
    
  • If you're using PostgreSQL, execute this additional SQL:
    ALTER TABLE redirects_id_seq RENAME TO django_redirects_id_seq;
    ALTER TABLE django_redirects ALTER COLUMN id DROP DEFAULT;
    ALTER TABLE django_redirects ALTER COLUMN id SET DEFAULT nextval('public.django_redirects_id_seq'::text);
    
  • Add "django.contrib.redirects" to your INSTALLED_APPS.
  • Add "django.contrib.redirects.middleware.RedirectFallbackMiddleware" to your MIDDLEWARE_CLASSES.

Refactored RSS framework

As of [1194], Django's RSS framework was refactored. This change should not affect most Django users, because the RSS framework was completely undocumented. The only users affected are people who reverse-engineered the framework, and WorldOnline.

See the new syndication docs. For completeness, here's what changed:

  • Created django/contrib/syndication.
  • Removed django/conf/urls/rss.py. The syndication system doesn't require its own URLconf anymore.
  • Moved django/views/rss/rss.py to django/contrib/syndication/views.py and refactored it so that feed() takes url and feed_dict instead of slug and param.
  • Renamed DefaultRssFeed to DefaultFeed in django/utils/feedgenerator.py.
  • RSS feeds are now specified as subclasses of django.contrib.syndication.feeds.Feed instead of django.core.rss.FeedConfiguration. Syntax is completely different.
  • RSS feeds are now registered in URLconfs rather than in "magic" settings modules whose names end with "_rss".
  • Templates for RSS titles and descriptions now live in a feeds directory, not an rss directory.

Changed field name and length for auth.User password_md5 field

As of [1327], the password_md5 field in the auth.User model, which is used for authentication in the Django admin, was renamed to password, and its length was changed from 32 to 128 to accomodate longer hashes and password metadata, such as which hash algorithm to use. This affects everybody who uses the Django authentication system -- including users of the Django admin.

Execute the following SQL to restore auth functionality:

  • PostgreSQL:
    BEGIN;
    ALTER TABLE auth_users ADD COLUMN password varchar(128);
    UPDATE auth_users SET password = password_md5;
    ALTER TABLE auth_users ALTER COLUMN password SET NOT NULL;
    ALTER TABLE auth_users DROP COLUMN password_md5;
    COMMIT;
    
  • MySQL:
    BEGIN;
    ALTER TABLE `auth_users` CHANGE `password_md5` `password` VARCHAR(128) NOT NULL;
    COMMIT;
    
  • SQLite:
    BEGIN;
    ALTER TABLE auth_users RENAME TO auth_users_old;
    CREATE TABLE auth_users (
        id integer NOT NULL PRIMARY KEY,
        username varchar(30) NOT NULL UNIQUE,
        first_name varchar(30) NOT NULL,
        last_name varchar(30) NOT NULL,
        email varchar(75) NOT NULL,
        password varchar(128) NOT NULL,
        is_staff bool NOT NULL,
        is_active bool NOT NULL,
        is_superuser bool NOT NULL,
        last_login datetime NOT NULL,
        date_joined datetime NOT NULL
    );
    INSERT INTO auth_users (
    	id,
    	username,
    	first_name,
    	last_name,
    	email,
    	password,
    	is_staff,
    	is_active,
    	is_superuser,
    	last_login,
    	date_joined
    )
    SELECT * FROM auth_users_old;
    DROP TABLE auth_users_old;
    COMMIT;
    

Template system changes

As of [1443], we changed the way custom template tags and filters are registered. If you've written custom template tags or filters, you'll need to make a couple of changes:

Filter arguments

For any filters that don't take an argument, remove the second argument to the filter function.

Old:

def lower(param, _):
    return param.lower()

New:

def lower(param):
    return param.lower()

The system now introspects the function's arguments to find out whether a filter argument is required.

Change the way your tags/filters are registered

Old way:

from django.core import template

template.register_filter('lower', lower, False)
template.register_tag('current_time', do_current_time)

New way:

from django.core import template

register = template.Library()
register.filter('lower', lower)
register.tag('current_time', do_current_time)

Change template decorator calls

If you're using the undocumented template decorators (simple_tag and inclusion_tag), change your calls to be members of the library class.

Old way:

simple_tag(func)
inclusion_tag('path/to/template')(func)

New way:

register.simple_tag(func)
register.inclusion_tag('path/to/template')(func)

Change template tags that use filters

Filters are compiled at compile time now.

Old way:

class SomethingNode(Node):
    def __init__(self, filter_string):
        self.filter_string = filter_string

    def render(self, context):
        var = resolve_variable_with_filters(self.filter_string, context)
        return var

def do_something(parser, token):
    bits = token.split()
    filter_string = bits[1]
    return SomethingNode(filter_string)

register_tag('something', do_something)

New way:

class SomethingNode(Node):
    def __init__(self, filter_expr):
        self.filter_expr = filter_expr

    def render(self, context):
        var = self.filter_expr.resolve(context)
        return var

def do_something(parser, token):
    bits = token.split()
    filter_string = bits[1]
    filter_expr = parser.compile_filter(filter_string)
    return SomethingNode(filter_expr)

register.tag('something', do_something)

See Writing custom template filters and Writing custom template tags for full documentation.

Templates

Templates that are included in another template using {% include %} or {% ssi %}, or extend a template using {% extends %}, must explicitly {% load %} all libraries they need for their tags and filters. Some templates may have worked in the past due to previous requests registering tags : this will no longer work.

Added support for non-named groups in URLconf regular expressions

As of [1470], Django URLconfs support non-named groups in URLconf regular expressions. This means you no longer have to specify the name of each group.

For example, this old syntax:

(r'^(?P<item_id>\d{1,3})/$', 'foo.item_detail'),

Can be shortened to this syntax:

(r'^(\d{1,3})/$', 'foo.item_detail'),

The algorithm it follows is: If there are any named groups, it will use those, ignoring all non-named groups. Otherwise, it will pass all non-named groups as positional arguments. In both cases, it will pass any extra_kwargs as keyword arguments.

The old syntax (named groups) still works. Use that in cases where you can't (or don't want to) couple the order of URL parameters with the order of your view function arguments.

There are two small backwards-incompatibilities about this change:

  • If you've written custom middleware that implements process_view(), you'll need to change it so it takes view_args and view_kwargs arguments instead of param_dict:
def process_view(self, request, view_func, view_args, view_kwargs)
  • On the off chance you have legacy URLconfs that have NO captured items but DO use capturing parenthesis (which until now would have had no effect), you'll need to either change your view code to accept the captured values, or uncapture them.

Changed behavior of MultiValueDict.items()

In [1504], the MultiValueDict (and QueryDict) items() method was changed to return the *last* member of each list rather than the full list.

This probably doesn't affect anybody, but it's listed here for completeness.

Old behavior:

>>> q = QueryDict('a=1&a=2')
>>> q.items()
[('a', ['1', 2'])]

New behavior:

>>> q = QueryDict('a=1&a=2')
>>> q.items()
[('a', '2')]

To emulate the old behavior, use the new lists() method:

>>> q = QueryDict('a=1&a=2')
>>> q.lists()
[('a', ['1', 2'])]

Removed undocumented '_or' database API parameter

As of [1508], the _or parameter no longer works. Use the new complex parameter. This likely doesn't affect anybody except World Online, because _or has been undocumented and vehemently discouraged on the mailing list.

Removed the magic

As of [2809], the magic-removal branch has been merged. There's a LONG LIST of backwards-incompatible changes, and they're all documented on the RemovingTheMagic wiki page.

Note: See TracWiki for help on using the wiki.
Back to Top