Django admin changes in SVN trunk
Recently in Django SVN trunk all admin interface changed to newforms. It doesn't have backward compatibility, so I provide some hints to upgrade existing Django applications.There are at least 3 steps for upgrading:Update urls.py to follow new admin URLs.Update admin classes.Change all newforms imports.Update urls.py to follow new admin URLs.Initially urls.py looks like:
urlpatterns = patterns('',
(r'^admin/', include('django.contrib.admin.urls')),
)
Now it should look like:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/(.*)', admin.site.root),
)
Update admin classes.Initially admin classes were a part of model classes. Now they should be moved to independent classes.If a model had empty class:
class Model1(models.Model):
class Admin:
pass
Now it is enough just register a model with admin site:
from dja…