summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-09-02 21:11:12 -0400
committerTim Graham <timograham@gmail.com>2017-09-22 12:51:18 -0400
commit5bcca2a056f56b75e6a21670b32b982ef98f422a (patch)
treed79c25c020adf4c8ba84d7dfde3b5aff63ed826e
parent48d57788ee56811fa77cd37b9edf40535f82d87e (diff)
Refs #27532 -- Removed Model._meta.has_auto_field per deprecation timeline.
-rw-r--r--django/db/models/options.py15
-rw-r--r--docs/releases/2.1.txt2
-rw-r--r--tests/model_meta/test_removedindjango21.py22
3 files changed, 2 insertions, 37 deletions
diff --git a/django/db/models/options.py b/django/db/models/options.py
index 0786e525b3..c0226643ef 100644
--- a/django/db/models/options.py
+++ b/django/db/models/options.py
@@ -1,6 +1,5 @@
import copy
import inspect
-import warnings
from bisect import bisect
from collections import OrderedDict, defaultdict
@@ -13,7 +12,6 @@ from django.db.models.fields import AutoField
from django.db.models.fields.proxy import OrderWrt
from django.db.models.query_utils import PathInfo
from django.utils.datastructures import ImmutableList, OrderedSet
-from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.functional import cached_property
from django.utils.text import camel_case_to_spaces, format_lazy
from django.utils.translation import override
@@ -818,19 +816,6 @@ class Options:
self._get_fields_cache[cache_key] = fields
return fields
- @property
- def has_auto_field(self):
- warnings.warn(
- 'Model._meta.has_auto_field is deprecated in favor of checking if '
- 'Model._meta.auto_field is not None.',
- RemovedInDjango21Warning, stacklevel=2
- )
- return self.auto_field is not None
-
- @has_auto_field.setter
- def has_auto_field(self, value):
- pass
-
@cached_property
def _property_names(self):
"""Return a set of the names of the properties defined on the model."""
diff --git a/docs/releases/2.1.txt b/docs/releases/2.1.txt
index de7150b7b7..fd56560365 100644
--- a/docs/releases/2.1.txt
+++ b/docs/releases/2.1.txt
@@ -254,3 +254,5 @@ how to remove usage of these features.
* The ``USE_ETAGS`` setting is removed. ``CommonMiddleware`` and
``django.utils.cache.patch_response_headers()`` no longer set ETags.
+
+* The ``Model._meta.has_auto_field`` attribute is removed.
diff --git a/tests/model_meta/test_removedindjango21.py b/tests/model_meta/test_removedindjango21.py
deleted file mode 100644
index 0e028c4f29..0000000000
--- a/tests/model_meta/test_removedindjango21.py
+++ /dev/null
@@ -1,22 +0,0 @@
-import warnings
-
-from django.test import SimpleTestCase
-
-from .models import Person
-
-
-class HasAutoFieldTests(SimpleTestCase):
-
- def test_get_warns(self):
- with warnings.catch_warnings(record=True) as warns:
- warnings.simplefilter('always')
- Person._meta.has_auto_field
- self.assertEqual(len(warns), 1)
- self.assertEqual(
- str(warns[0].message),
- 'Model._meta.has_auto_field is deprecated in favor of checking if '
- 'Model._meta.auto_field is not None.',
- )
-
- def test_set_does_nothing(self):
- Person._meta.has_auto_field = True