kopia lustrzana https://github.com/wagtail/wagtail
				
				
				
			Update modeladmin deprecation and migration notes to also mention ModelViewSet
							rodzic
							
								
									cb05df3435
								
							
						
					
					
						commit
						b14d6b9ab2
					
				|  | @ -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. | 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} | ```{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. | 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. | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | @ -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`. | 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 | ## Installation | ||||||
| 
 | 
 | ||||||
| Ensure `wagtail.snippets` is in your `INSTALLED_APPS`: | Ensure `wagtail.snippets` is in your `INSTALLED_APPS`: | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Sage Abdullah
						Sage Abdullah