mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Remove deprecation warning
This commit is contained in:
parent
7600f419e8
commit
09bc28fc86
@ -1,5 +1,4 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import warnings
|
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.db.models.fields import BLANK_CHOICE_DASH
|
from django.db.models.fields import BLANK_CHOICE_DASH
|
||||||
@ -13,7 +12,6 @@ from django.utils.safestring import mark_safe
|
|||||||
|
|
||||||
from wagtail.core.rich_text import RichText
|
from wagtail.core.rich_text import RichText
|
||||||
from wagtail.core.utils import resolve_model_string
|
from wagtail.core.utils import resolve_model_string
|
||||||
from wagtail.utils.deprecation import RemovedInWagtail24Warning
|
|
||||||
|
|
||||||
from .base import Block
|
from .base import Block
|
||||||
|
|
||||||
@ -597,12 +595,10 @@ class ChooserBlock(FieldBlock):
|
|||||||
|
|
||||||
class PageChooserBlock(ChooserBlock):
|
class PageChooserBlock(ChooserBlock):
|
||||||
def __init__(self, page_type=None, can_choose_root=False, target_model=None, **kwargs):
|
def __init__(self, page_type=None, can_choose_root=False, target_model=None, **kwargs):
|
||||||
|
# We cannot simply deprecate 'target_model' in favour of 'page_type'
|
||||||
|
# as it would force developers to update their old migrations.
|
||||||
|
# Mapping the old 'target_model' to the new 'page_type' kwarg instead.
|
||||||
if target_model:
|
if target_model:
|
||||||
warnings.warn(
|
|
||||||
"PageChooserBlock's `target_model` parameter is deprecated. "
|
|
||||||
"Please use `page_type` instead.",
|
|
||||||
category=RemovedInWagtail24Warning
|
|
||||||
)
|
|
||||||
page_type = target_model
|
page_type = target_model
|
||||||
|
|
||||||
if page_type:
|
if page_type:
|
||||||
|
Loading…
Reference in New Issue
Block a user