kopia lustrzana https://github.com/wagtail/wagtail
Moved snippet content_type parameter removal to 1.6
rodzic
909319a855
commit
3d04382a41
|
@ -6,7 +6,7 @@ from django.template.loader import render_to_string
|
|||
from django.utils.safestring import mark_safe
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
from wagtail.utils.deprecation import RemovedInWagtail15Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail16Warning
|
||||
from wagtail.wagtailadmin.edit_handlers import BaseChooserPanel
|
||||
from wagtail.wagtailcore.utils import resolve_model_string
|
||||
from .widgets import AdminSnippetChooser
|
||||
|
@ -25,7 +25,7 @@ class BaseSnippetChooserPanel(BaseChooserPanel):
|
|||
def target_model(cls):
|
||||
if cls._target_model is None:
|
||||
if cls.snippet_type:
|
||||
# RemovedInWagtail15Warning: The target_model is automatically
|
||||
# RemovedInWagtail16Warning: The target_model is automatically
|
||||
# detected from the relation, so snippet_type is deprecated.
|
||||
try:
|
||||
cls._target_model = resolve_model_string(cls.snippet_type)
|
||||
|
@ -59,7 +59,7 @@ class SnippetChooserPanel(object):
|
|||
warnings.warn(
|
||||
'The snippet_type argument to SnippetChooserPanel is deprecated. '
|
||||
'The related model is now automatically detected.',
|
||||
RemovedInWagtail15Warning)
|
||||
RemovedInWagtail16Warning)
|
||||
self.snippet_type = snippet_type
|
||||
|
||||
def bind_to_model(self, model):
|
||||
|
|
|
@ -297,7 +297,7 @@ class TestSnippetChooserPanel(TestCase, WagtailTestUtils):
|
|||
self.snippet_chooser_panel.render_as_field())
|
||||
|
||||
def test_target_model_from_string(self):
|
||||
# RemovedInWagtail15Warning: snippet_type argument
|
||||
# RemovedInWagtail16Warning: snippet_type argument
|
||||
with self.ignore_deprecation_warnings():
|
||||
result = SnippetChooserPanel(
|
||||
'advert',
|
||||
|
@ -306,7 +306,7 @@ class TestSnippetChooserPanel(TestCase, WagtailTestUtils):
|
|||
self.assertIs(result, Advert)
|
||||
|
||||
def test_target_model_from_model(self):
|
||||
# RemovedInWagtail15Warning: snippet_type argument
|
||||
# RemovedInWagtail16Warning: snippet_type argument
|
||||
with self.ignore_deprecation_warnings():
|
||||
result = SnippetChooserPanel(
|
||||
'advert',
|
||||
|
@ -321,7 +321,7 @@ class TestSnippetChooserPanel(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(result, Advert)
|
||||
|
||||
def test_target_model_malformed_type(self):
|
||||
# RemovedInWagtail15Warning: snippet_type argument
|
||||
# RemovedInWagtail16Warning: snippet_type argument
|
||||
with self.ignore_deprecation_warnings():
|
||||
result = SnippetChooserPanel(
|
||||
'advert',
|
||||
|
@ -331,7 +331,7 @@ class TestSnippetChooserPanel(TestCase, WagtailTestUtils):
|
|||
result.target_model)
|
||||
|
||||
def test_target_model_nonexistent_type(self):
|
||||
# RemovedInWagtail15Warning: snippet_type argument
|
||||
# RemovedInWagtail16Warning: snippet_type argument
|
||||
with self.ignore_deprecation_warnings():
|
||||
result = SnippetChooserPanel(
|
||||
'advert',
|
||||
|
|
Ładowanie…
Reference in New Issue