From 37c9913a35cf41139b69a66fdf4c28f76e06ac00 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Sat, 4 Nov 2017 08:16:46 +0000 Subject: [PATCH] Eliminate remaining field.rel deprecation warnings from tests --- wagtail/wagtailadmin/utils.py | 2 +- wagtail/wagtailcore/models.py | 2 +- wagtail/wagtailsnippets/edit_handlers.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wagtail/wagtailadmin/utils.py b/wagtail/wagtailadmin/utils.py index 172ea6a002..1d9a5396d9 100644 --- a/wagtail/wagtailadmin/utils.py +++ b/wagtail/wagtailadmin/utils.py @@ -76,7 +76,7 @@ def get_object_usage(obj): # if the relation is between obj and an object that has a page as a # property, return the page for f in related_model._meta.fields: - if isinstance(f, ParentalKey) and issubclass(f.rel.to, Page): + if isinstance(f, ParentalKey) and issubclass(f.remote_field.model, Page): pages |= Page.objects.filter( id__in=related_model._base_manager.filter( **{ diff --git a/wagtail/wagtailcore/models.py b/wagtail/wagtailcore/models.py index 59434b09bc..70bc1e59fa 100644 --- a/wagtail/wagtailcore/models.py +++ b/wagtail/wagtailcore/models.py @@ -1050,7 +1050,7 @@ class Page(six.with_metaclass(PageBase, AbstractPage, index.Indexed, Clusterable continue # Ignore parent links (page_ptr) - if isinstance(field, models.OneToOneField) and field.rel.parent_link: + if isinstance(field, models.OneToOneField) and field.remote_field.parent_link: continue specific_dict[field.name] = getattr(specific_self, field.name) diff --git a/wagtail/wagtailsnippets/edit_handlers.py b/wagtail/wagtailsnippets/edit_handlers.py index 3d8d8adc59..4eab9b7b7b 100644 --- a/wagtail/wagtailsnippets/edit_handlers.py +++ b/wagtail/wagtailsnippets/edit_handlers.py @@ -20,7 +20,7 @@ class BaseSnippetChooserPanel(BaseChooserPanel): @classmethod def target_model(cls): if cls._target_model is None: - cls._target_model = cls.model._meta.get_field(cls.field_name).rel.model + cls._target_model = cls.model._meta.get_field(cls.field_name).remote_field.model return cls._target_model