From b14d6b9ab2d9e73a6616ffd0f4214de3899832c1 Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Tue, 31 Oct 2023 14:58:50 +0000 Subject: [PATCH] Update modeladmin deprecation and migration notes to also mention ModelViewSet --- docs/reference/contrib/modeladmin/index.md | 2 +- .../contrib/modeladmin/migrating_to_snippets.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/reference/contrib/modeladmin/index.md b/docs/reference/contrib/modeladmin/index.md index f5e977320e..d68697eae6 100644 --- a/docs/reference/contrib/modeladmin/index.md +++ b/docs/reference/contrib/modeladmin/index.md @@ -3,7 +3,7 @@ The `modeladmin` module allows you to add any model in your project to the Wagtail admin. You can create customisable listing pages for a model, including plain Django models, and add navigation elements so that a model can be accessed directly from the Wagtail admin. Simply extend the `ModelAdmin` class, override a few attributes to suit your needs, register it with Wagtail using an easy one-line `modeladmin_register` method (you can copy and paste from the examples below), and you're good to go. Your model doesn’t need to extend `Page` or be registered as a `Snippet`, and it won’t interfere with any of the existing admin functionality that Wagtail provides. ```{note} -The `modeladmin` module is deprecated. To manage non-page models in Wagtail, use [`wagtail.snippets`](snippets) instead. For more details, see [](./migrating_to_snippets.md). +The `modeladmin` module is deprecated. To manage non-page models in Wagtail, use [`wagtail.snippets`](snippets) or [`ModelViewSet`](generic_views) instead. For more details, see [](./migrating_to_snippets.md). If you still rely on ModelAdmin, use the separate [wagtail-modeladmin](https://github.com/wagtail-nest/wagtail-modeladmin) package. The `wagtail.contrib.modeladmin` module will be removed in a future release. ``` diff --git a/docs/reference/contrib/modeladmin/migrating_to_snippets.md b/docs/reference/contrib/modeladmin/migrating_to_snippets.md index 4334536346..512340ea8a 100644 --- a/docs/reference/contrib/modeladmin/migrating_to_snippets.md +++ b/docs/reference/contrib/modeladmin/migrating_to_snippets.md @@ -2,6 +2,15 @@ To provide a single, unified way to manage non-page Django models, the `modeladmin` contrib module has been deprecated in favor of the `snippets` module. This page explains how to migrate from `modeladmin` to `snippets`. +```{versionadded} 5.2 +If you would rather not register the models as snippets, you can also use `ModelViewSet`. The migration explained with `SnippetViewSet` and `SnippetViewSetGroup` on this page can be substituted with `ModelViewSet` and `ModelViewSetGroup`. However, as of this release, the `ModelViewSet` does not support the following: + +- The use of `panels`, `edit_handler` as described in [](modeladmin_edit_handler_customisation). +- The `get_queryset` method as described in [](modeladmin_get_queryset). + +See [](generic_views) for more details on using `ModelViewSet`. +``` + ## Installation Ensure `wagtail.snippets` is in your `INSTALLED_APPS`: