The powerful ModelAdmin
feature of Wagtail CMS has been removed as of Wagtail v6. The Wagtail team now encourages the use of SnippetViewSet
, which includes advanced features like bulk actions. Here is an official migration guide from ModelAdmin
to Snippets
.
However, if you have extensive custom code reliant on ModelAdmin
, or numerous ModelAdmin
instances, and find that migrating them to SnippetViewSet
would be time-consuming (a common issue in one of the projects I maintain), it doesn't mean you can't upgrade to Wagtail v6. ModelAdmin
has been spun off from Wagtail CMS into a separate package called wagtail-modeladmin.
Thus, if you upgrade to Wagtail v6 and encounter error messages such as: ModuleNotFoundError: No module named 'wagtail.contrib.modeladmin'
, do not worry. Simply follow these steps to switch from deprecated wagtail.contrib.modeladmin
to wagtail-modeladmin
:
Install the wagtail-modeladmin
package:
python -m pip install wagtail-modeladmin
Add wagtail_modeladmin
to the INSTALLED_APPS
in your settings.py
file:
INSTALLED_APPS = [
# ...
"wagtail_modeladmin",
# ...
]
Replace all occurrences of wagtail.contrib.modeladmin
with wagtail_modeladmin
in the .py
files within your Python project. Use your editor’s "Find and Replace" feature to make this change efficiently.
By following these steps, you should have successfully transitioned to using wagtail-modeladmin
. This will give you ample time to plan a migration to SnippetViewSet
as needed.
Hey, if you've found this useful, please share the post to help other folks find it: