Deprecate wagtail.contrib.modeladmin

pull/10658/head
Sage Abdullah 2023-07-10 17:00:19 +01:00
rodzic f8da5f1be1
commit 191ddf8a55
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: EB1A33CC51CC0217
5 zmienionych plików z 30 dodań i 1 usunięć

Wyświetl plik

@ -105,6 +105,7 @@ Changelog
* Maintenance: Migrate dialog instantiation to a new `w-dialog` Stimulus controller (Loveth Omokaro, LB (Ben) Johnston)
* Maintenance: Support dialog template cloning using a new `w-teleport` Stimulus controller (Loveth Omokaro, LB (Ben) Johnston)
* Maintenance: Migrate away from using the `"wagtailadmin/shared/field_as_li.html"` template include (Storm Heg)
* Maintenance: Deprecate `wagtail.contrib.modeladmin` (Sage Abdullah)
5.0.2 (21.06.2023)

Wyświetl plik

@ -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 doesnt need to extend `Page` or be registered as a `Snippet`, and it wont interfere with any of the existing admin functionality that Wagtail provides.
```{note}
The `modeladmin` module will be deprecated in a future release and published as a separate package. We recommend using [](snippets) instead.
The `modeladmin` module is deprecated. To manage non-page models in Wagtail, use [`wagtail.snippets`](snippets) instead. 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.
```
(modeladmin_feature_summary)=

Wyświetl plik

@ -179,6 +179,10 @@ The Elasticsearch 5 and 6 search backends are deprecated and will be removed in
The `insert_editor_css` hook has been deprecated. The `insert_global_admin_css` hook has the same functionality, and all uses of `insert_editor_css` should be changed to `insert_global_admin_css`.
### `wagtail.contrib.modeladmin` is deprecated
As part of the [RFC 85: Snippets parity with ModelAdmin](https://github.com/wagtail/rfcs/pull/85) implementation, the `wagtail.contrib.modeladmin` app is deprecated. To manage non-page models in Wagtail, use [`wagtail.snippets`](snippets) instead. 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.
### `UserPagePermissionsProxy` is deprecated
The undocumented `wagtail.models.UserPagePermissionsProxy` class is deprecated.

Wyświetl plik

@ -1,8 +1,19 @@
from warnings import warn
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
from wagtail.utils.deprecation import RemovedInWagtail60Warning
class WagtailModelAdminAppConfig(AppConfig):
name = "wagtail.contrib.modeladmin"
label = "wagtailmodeladmin"
verbose_name = _("Wagtail ModelAdmin")
def ready(self):
warn(
"wagtail.contrib.modeladmin is deprecated. "
"Use wagtail.snippets or the separate wagtail-modeladmin package instead.",
category=RemovedInWagtail60Warning,
)

Wyświetl plik

@ -0,0 +1,13 @@
from django.apps import apps
from django.test import SimpleTestCase
class TestDeprecationWarning(SimpleTestCase):
def test_deprecation_warning(self):
config = apps.get_app_config("wagtailmodeladmin")
with self.assertWarnsMessage(
DeprecationWarning,
"wagtail.contrib.modeladmin is deprecated. "
"Use wagtail.snippets or the separate wagtail-modeladmin package instead.",
):
config.ready()