summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-09-03 14:57:57 -0400
committerTim Graham <timograham@gmail.com>2015-09-23 19:31:10 -0400
commit75374d3797c2cd2423982a870bb0bc74821e951f (patch)
tree33d0560200ea93e2c96704a05c7a207c4a8ba12f
parenta3fe4addcb9063fc327c8609c7ebba4d531da4ce (diff)
Refs #24099 -- Removed compatibility shim for ContentType.name field.
-rw-r--r--django/contrib/contenttypes/models.py11
-rw-r--r--docs/ref/contrib/contenttypes.txt5
-rw-r--r--tests/contenttypes_tests/test_models.py21
3 files changed, 0 insertions, 37 deletions
diff --git a/django/contrib/contenttypes/models.py b/django/contrib/contenttypes/models.py
index 27a5388a70..a0c9fb0903 100644
--- a/django/contrib/contenttypes/models.py
+++ b/django/contrib/contenttypes/models.py
@@ -1,11 +1,8 @@
from __future__ import unicode_literals
-import warnings
-
from django.apps import apps
from django.db import models
from django.db.utils import IntegrityError, OperationalError, ProgrammingError
-from django.utils.deprecation import RemovedInDjango110Warning
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@@ -36,14 +33,6 @@ class ContentTypeManager(models.Manager):
key = (opts.app_label, opts.model_name)
return self.__class__._cache[self.db][key]
- def create(self, **kwargs):
- if 'name' in kwargs:
- del kwargs['name']
- warnings.warn(
- "ContentType.name field doesn't exist any longer. Please remove it from your code.",
- RemovedInDjango110Warning, stacklevel=2)
- return super(ContentTypeManager, self).create(**kwargs)
-
def get_for_model(self, model, for_concrete_model=True):
"""
Returns the ContentType object for a given model, creating the
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt
index d305039811..243a96aa55 100644
--- a/docs/ref/contrib/contenttypes.txt
+++ b/docs/ref/contrib/contenttypes.txt
@@ -82,11 +82,6 @@ The ``ContentType`` model
:attr:`verbose_name <django.db.models.Field.verbose_name>`
attribute of the model.
-.. versionchanged:: 1.8
-
- Before Django 1.8, the ``name`` property was a real field on the
- ``ContentType`` model.
-
Let's look at an example to see how this works. If you already have
the :mod:`~django.contrib.contenttypes` application installed, and then add
:mod:`the sites application <django.contrib.sites>` to your
diff --git a/tests/contenttypes_tests/test_models.py b/tests/contenttypes_tests/test_models.py
index eb436b6a64..37e0b93048 100644
--- a/tests/contenttypes_tests/test_models.py
+++ b/tests/contenttypes_tests/test_models.py
@@ -1,7 +1,5 @@
from __future__ import unicode_literals
-import warnings
-
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.shortcuts import get_current_site
@@ -247,25 +245,6 @@ class ContentTypesTests(TestCase):
ct_fetched = ContentType.objects.get_for_id(ct.pk)
self.assertIsNone(ct_fetched.model_class())
- def test_name_deprecation(self):
- """
- ContentType.name has been removed. Test that a warning is emitted when
- creating a ContentType with a `name`, but the creation should not fail.
- """
- with warnings.catch_warnings(record=True) as warns:
- warnings.simplefilter('always')
- ContentType.objects.create(
- name='Name',
- app_label='contenttypes',
- model='OldModel',
- )
- self.assertEqual(len(warns), 1)
- self.assertEqual(
- str(warns[0].message),
- "ContentType.name field doesn't exist any longer. Please remove it from your code."
- )
- self.assertTrue(ContentType.objects.filter(model='OldModel').exists())
-
@mock.patch('django.contrib.contenttypes.models.ContentTypeManager.get_or_create')
@mock.patch('django.contrib.contenttypes.models.ContentTypeManager.get')
def test_message_if_get_for_model_fails(self, mocked_get, mocked_get_or_create):