From 2e6dd975a228d8a590248da38a2b6f4e74876260 Mon Sep 17 00:00:00 2001 From: Charlie Denton Date: Tue, 31 Oct 2017 17:22:27 +0000 Subject: [PATCH] [2.0.x] Fixed #28750 -- Allowed models to define Meta.manager_inheritance_from_future for backwards compatibility. Refs 631f4ab06112aca5bd6a57b81159048f936050bf. Backport of cbe334918a0a80762249706a15b699714b5dc828 from master --- django/db/models/options.py | 2 ++ .../test_manager_inheritance_from_future.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/model_meta/test_manager_inheritance_from_future.py diff --git a/django/db/models/options.py b/django/db/models/options.py index 0786e525b3..666885aeed 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -35,6 +35,8 @@ DEFAULT_NAMES = ( 'select_on_save', 'default_related_name', 'required_db_features', 'required_db_vendor', 'base_manager_name', 'default_manager_name', 'indexes', + # For backwards compatibility with Django 1.11. RemovedInDjango30Warning + 'manager_inheritance_from_future', ) diff --git a/tests/model_meta/test_manager_inheritance_from_future.py b/tests/model_meta/test_manager_inheritance_from_future.py new file mode 100644 index 0000000000..2359489283 --- /dev/null +++ b/tests/model_meta/test_manager_inheritance_from_future.py @@ -0,0 +1,15 @@ +from django.db import models +from django.test import SimpleTestCase +from django.test.utils import isolate_apps + + +@isolate_apps('model_meta') +class TestManagerInheritanceFromFuture(SimpleTestCase): + def test_defined(self): + """ + Meta.manager_inheritance_from_future can be defined for backwards + compatibility with Django 1.11. + """ + class FuturisticModel(models.Model): + class Meta: + manager_inheritance_from_future = True # No error raised.