Code

Changes between Version 11 and Version 12 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
10/18/05 17:44:50 (9 years ago)
Author:
adrian
Comment:

Added preliminary "Refactored the admin app" section (Refs #627)

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v11 v12  
    114114 
    115115As of [867], {{{django.core.template_loader}}} is deprecated. Use {{{django.core.template.loader}}} instead. 
     116 
     117== Refactored the admin app not to require its own settings file == 
     118 
     119As of an upcoming changeset, the admin will have been refactored. 
     120 
     121=== What changed === 
     122 
     123 * The admin no longer requires its own settings file. The "main" site and admin site can run on the same Django installation. 
     124 * All the admin code moved to {{{django/contrib/admin}}}. 
     125 * If you're using the admin, you need to add {{{"django.contrib.admin"}}} to your {{{INSTALLED_APPS}}}. 
     126 * The admin database table isn't installed unless you explicitly have the admin installed ({{{django-admin.py install admin}}}). 
     127 * Renamed the admin log database table to give it a {{{"django"}}} prefix. 
     128 
     129=== How to update your code === 
     130 
     131If you're using a Django installation from before this changeset, do the following to restore your admin site: 
     132 
     133 * Execute this SQL command: {{{ALTER TABLE auth_admin_log RENAME TO django_admin_log;}}} 
     134 * Edit your Django settings file (probably called {{{settings/main.py}}}) to make the following changes: 
     135   * Add {{{"django.contrib.admin"}}} to {{{INSTALLED_APPS}}}. Order doesn't matter; it can be the first, last, whatever. 
     136   * Remove {{{"django.middleware.admin.AdminUserRequired"}}} from {{{MIDDLEWARE_CLASSES}}}, if it's in there. 
     137   * Add {{{"django.middleware.sessions.SessionMiddleware"}}} to {{{MIDDLEWARE_CLASSES}}}, if it's not already in there. 
     138   * 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: 
     139     {{{ 
     140     TEMPLATE_LOADERS = ( 
     141         'django.core.template.loaders.filesystem.load_template_source', 
     142         'django.core.template.loaders.app_directories.load_template_source', 
     143     ) 
     144     }}} 
     145 
     146 * Remove your admin settings file (probably called {{{settings/admin.py}}}) and admin URLconf (probably called {{{settings/urls/admin.py}}}). 
     147 * Edit your main URLconf (probably called {{{settings/urls/main.py}}}) and add this line: 
     148 
     149     {{{ 
     150     (r'^admin/', include('django.contrib.admin.urls.admin')), 
     151     }}} 
     152 
     153   Change that {{{"admin"}}} to whatever URL you were using for the admin site. 
     154 
     155The following steps are optional but will tighten your code up. All assume your project is called {{{myproject}}}. 
     156 
     157 * Move {{{myproject/settings/urls/main.py}}} to {{{myproject/urls.py}}}. 
     158 * Delete {{{myproject/settings/urls/admin.py}}} (unless you had custom things in it, of course). 
     159 * Move {{{myproject/settings/main.py}}} to {{{myproject/settings.py}}}. 
     160 * Edit {{{myproject/settings.py}}} to change {{{ROOT_URLCONF}} from {{{"myproject.settings.urls.main"}}} to {{{"myproject.urls"}}}.