Skip to main content

🚚 Moving from the classic Django admin

Content Studio follows the conventions of ModelAdmin where it can, so most of a classic Django admin configuration carries over with new names. This guide moves a project over one model at a time, with both admins running side by side until the last model has moved.

1. Run both admins​

Content Studio keeps its own registry and its own URLs, so it runs next to the classic Django admin. Install it as on Getting started, and give each admin its own prefix:

# mysite/urls.py
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path("admin/", include("content_studio.urls")),
path("django-admin/", admin.site.urls),
]

Keep django.contrib.admin in INSTALLED_APPS even after the move: Content Studio records its activity log in the classic admin's LogEntry model, so the history editors already have stays visible.

Staff users, groups and permissions are the same in both admins. An editor who may change articles in one may change them in the other.

2. Move one model​

Content Studio reads registrations from the same admin.py files, so the classic registration and the new one can live next to each other. Take a classic registration:

# blog/admin.py (before)
from django.contrib import admin

from .models import Article


@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
list_display = ["title", "status", "published_at"]
list_filter = ["status"]
search_fields = ["title"]
prepopulated_fields = {"slug": ("title",)}
fieldsets = [
("Content", {"fields": ["title", "slug", "body"]}),
("Publishing", {"fields": ["status", "published_at"]}),
]

Add a studio for the same model:

# blog/admin.py (after)
from django.contrib import admin

from content_studio import register
from content_studio.admin import ModelStudio
from content_studio.form import FormSet

from .models import Article


@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
list_display = ["title", "status", "published_at"]


@register(Article)
class ArticleStudio(ModelStudio):
table_display = ["title", "status", "published_at"]
list_filter = ["status"]
search_fields = ["title"]
prepopulated_fields = {"slug": ("title",)}
edit_main = [
FormSet(title="Content", fields=["title", "slug", "body"]),
]
edit_sidebar = ["status", "published_at"]

Run manage.py check. The system checks report options with an old name (such as list_display, W010) and mistakes such as a required field missing from the edit page (W001). When the studio does what the ModelAdmin did, remove the ModelAdmin.

3. Translate the options​

The table maps the classic options to their Content Studio equivalent. Options not listed work under the same name, with the same meaning.

Classic Django adminContent Studio
admin.site.register(Article, ArticleAdmin), @admin.register@register(Article) from content_studio (Registering models)
ModelAdminModelStudio; name the class ArticleStudio
AdminSiteContentStudioSite, named by the ADMIN_SITE setting
list_displaytable_display, with TableColumn for a header or a format (Table columns)
A method in list_display, @admin.displayA studio method (self, obj, request) named in table_display, or a TableColumn with a header
list_display_linksThe first column opens the object
list_editabletable_edit (Editing in the table)
date_hierarchyA calendar view or a date filter
fieldsets, fieldsedit_main and edit_sidebar with FormSet, FieldLayout and Field (Edit page layout)
formfield_overridesField(name, widget=...), or the site's default_widget_mapping (Widgets)
raw_id_fields, autocomplete_fields, filter_horizontalNot needed: foreign keys and many-to-many fields get a searchable picker that can also create the related object (Related objects)
TabularInline, StackedInlineInlineModelStudio in the studio's inlines (Inlines)
actions, @admin.action@bulk_action methods; the return value is the message editors see (Bulk actions)
save_as = Trueallow_duplication = True (Duplicating objects)
save_model(request, obj, form, change)save_model(request, obj, data, change): data holds the saved values by field name (Saving and deleting)
ModelAdmin.form, a custom ModelFormThe model's clean() and constraints, which the edit page runs (Model validation), and conditional fields
get_urls(), custom admin viewsPages and links in the menu with extensions
Template overridesComponents on the edit page, and custom widgets and formats

These work as in the classic admin: search_fields, list_filter (plus paths across relations and filter classes), ordering, sortable_by, list_per_page, readonly_fields, prepopulated_fields, exclude, view_on_site, get_queryset and the four has_*_permission methods (Access control).

4. Move the users​

The user model and Django's groups appear in Content Studio without a registration, with an invite flow, a password dialog and a permission matrix. If your classic admin customizes them, subclass the default studios; see User management.

5. Use what is new​

With the models moved, editors get what the classic admin does not offer. Most of it is a setting or a line in a studio:

The apps overview lists every building block.

6. Remove the classic admin's URLs​

When no ModelAdmin is left that editors use, remove path("django-admin/", admin.site.urls) from your URLs. Keep django.contrib.admin in INSTALLED_APPS, for the activity log.

What to watch for​

  • Only registered models appear. A model registered only with the classic admin does not show in Content Studio. Register a studio for every model editors work with.
  • The edit page saves the fields it shows. As in the classic admin, a required field left out of edit_main and edit_sidebar makes saving fail; check W001 reports it.
  • Custom admin templates and JavaScript do not carry over. Content Studio is a separate admin. Rebuild what they did with components, extensions or custom widgets.