summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-12-31 10:30:41 -0500
committerTim Graham <timograham@gmail.com>2017-01-17 20:52:02 -0500
commitbcf3532ede16407f1a701717deaed835eda3e87b (patch)
treed4b6167d5c47c42fcae8f05dd86b03adb7faa33c
parentbc3540ce2c7cc59ec39a23ed16b14cc12f485bf3 (diff)
Refs #26154 -- Removed deprecated CommaSeparatedIntegerField.
-rw-r--r--django/db/backends/mysql/base.py1
-rw-r--r--django/db/backends/oracle/base.py1
-rw-r--r--django/db/backends/postgresql/base.py1
-rw-r--r--django/db/backends/sqlite3/base.py1
-rw-r--r--django/db/models/fields/__init__.py21
-rw-r--r--docs/ref/checks.txt5
-rw-r--r--docs/ref/databases.txt3
-rw-r--r--docs/ref/models/fields.txt15
-rw-r--r--docs/releases/2.0.txt3
-rw-r--r--docs/topics/forms/modelforms.txt2
-rw-r--r--tests/expressions_case/models.py1
-rw-r--r--tests/expressions_case/tests.py14
-rw-r--r--tests/inspectdb/models.py1
-rw-r--r--tests/inspectdb/tests.py1
-rw-r--r--tests/invalid_models_tests/test_deprecated_fields.py9
-rw-r--r--tests/model_fields/models.py40
-rw-r--r--tests/model_fields/test_promises.py15
-rw-r--r--tests/model_fields/tests.py2
-rw-r--r--tests/model_forms/models.py8
-rw-r--r--tests/model_forms/tests.py41
-rw-r--r--tests/model_inheritance_regress/models.py1
-rwxr-xr-xtests/runtests.py1
22 files changed, 48 insertions, 139 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index d7bb129744..a2416c82cd 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -135,7 +135,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'BinaryField': 'longblob',
'BooleanField': 'bool',
'CharField': 'varchar(%(max_length)s)',
- 'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
'DateField': 'date',
'DateTimeField': 'datetime',
'DecimalField': 'numeric(%(max_digits)s, %(decimal_places)s)',
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index c40a515f33..cf17f9fa6c 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -89,7 +89,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'BinaryField': 'BLOB',
'BooleanField': 'NUMBER(1)',
'CharField': 'NVARCHAR2(%(max_length)s)',
- 'CommaSeparatedIntegerField': 'VARCHAR2(%(max_length)s)',
'DateField': 'DATE',
'DateTimeField': 'TIMESTAMP',
'DecimalField': 'NUMBER(%(max_digits)s, %(decimal_places)s)',
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index c40a67b2e1..85a21a8905 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -76,7 +76,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'BinaryField': 'bytea',
'BooleanField': 'boolean',
'CharField': 'varchar(%(max_length)s)',
- 'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
'DateField': 'date',
'DateTimeField': 'timestamp with time zone',
'DecimalField': 'numeric(%(max_digits)s, %(decimal_places)s)',
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 0c26882a57..252293d9cc 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -73,7 +73,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'BinaryField': 'BLOB',
'BooleanField': 'bool',
'CharField': 'varchar(%(max_length)s)',
- 'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
'DateField': 'date',
'DateTimeField': 'datetime',
'DecimalField': 'decimal',
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index f5d6734aab..2018797564 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -1090,27 +1090,18 @@ class CharField(Field):
class CommaSeparatedIntegerField(CharField):
default_validators = [validators.validate_comma_separated_integer_list]
description = _("Comma-separated integers")
- system_check_deprecated_details = {
+ system_check_removed_details = {
'msg': (
- 'CommaSeparatedIntegerField has been deprecated. Support '
- 'for it (except in historical migrations) will be removed '
- 'in Django 2.0.'
+ 'CommaSeparatedIntegerField is removed except for support in '
+ 'historical migrations.'
),
'hint': (
- 'Use CharField(validators=[validate_comma_separated_integer_list]) instead.'
+ 'Use CharField(validators=[validate_comma_separated_integer_list]) '
+ 'instead.'
),
- 'id': 'fields.W901',
+ 'id': 'fields.E901',
}
- def formfield(self, **kwargs):
- defaults = {
- 'error_messages': {
- 'invalid': _('Enter only digits separated by commas.'),
- }
- }
- defaults.update(kwargs)
- return super(CommaSeparatedIntegerField, self).formfield(**defaults)
-
class DateTimeCheckMixin(object):
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt
index d5d0bd4e0f..fbdb34c7d9 100644
--- a/docs/ref/checks.txt
+++ b/docs/ref/checks.txt
@@ -174,7 +174,10 @@ Model fields
(except in historical migrations) will be removed in Django 1.9. *This check
appeared in Django 1.7 and 1.8*.
* **fields.W901**: ``CommaSeparatedIntegerField`` has been deprecated. Support
- for it (except in historical migrations) will be removed in Django 2.0.
+ for it (except in historical migrations) will be removed in Django 2.0. *This
+ check appeared in Django 1.10 and 1.11*.
+* **fields.E901**: ``CommaSeparatedIntegerField`` is removed except for support
+ in historical migrations.
File fields
~~~~~~~~~~~
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index 0c2465a9af..03fed7db24 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -584,8 +584,7 @@ Character fields
Any fields that are stored with ``VARCHAR`` column types have their
``max_length`` restricted to 255 characters if you are using ``unique=True``
for the field. This affects :class:`~django.db.models.CharField`,
-:class:`~django.db.models.SlugField` and
-:class:`~django.db.models.CommaSeparatedIntegerField`.
+:class:`~django.db.models.SlugField`.
``TextField`` limitations
~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 1d03bf99f2..5e6e2e1c0e 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -480,21 +480,6 @@ The default form widget for this field is a :class:`~django.forms.TextInput`.
of. Refer to the :ref:`MySQL database notes <mysql-collation>` for
details.
-``CommaSeparatedIntegerField``
-------------------------------
-
-.. class:: CommaSeparatedIntegerField(max_length=None, **options)
-
-.. deprecated:: 1.9
-
- This field is deprecated in favor of :class:`~django.db.models.CharField`
- with ``validators=[``\ :func:`validate_comma_separated_integer_list
- <django.core.validators.validate_comma_separated_integer_list>`\ ``]``.
-
-A field of integers separated by commas. As in :class:`CharField`, the
-:attr:`~CharField.max_length` argument is required and the note about database
-portability mentioned there should be heeded.
-
``DateField``
-------------
diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt
index 723c695533..9be5fda3ca 100644
--- a/docs/releases/2.0.txt
+++ b/docs/releases/2.0.txt
@@ -342,3 +342,6 @@ these features.
* The ``shell --plain`` option is removed.
* The ``django.core.urlresolvers`` module is removed.
+
+* ``CommaSeparatedIntegerField`` is removed, except for support in historical
+ migrations.
diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt
index bc0c124014..eb397a3d4a 100644
--- a/docs/topics/forms/modelforms.txt
+++ b/docs/topics/forms/modelforms.txt
@@ -70,8 +70,6 @@ Model field Form field
:attr:`~django.forms.CharField.empty_value`
set to ``None`` if ``null=True``.
-:class:`CommaSeparatedIntegerField` :class:`~django.forms.CharField`
-
:class:`DateField` :class:`~django.forms.DateField`
:class:`DateTimeField` :class:`~django.forms.DateTimeField`
diff --git a/tests/expressions_case/models.py b/tests/expressions_case/models.py
index 1471239896..9f559a4f9d 100644
--- a/tests/expressions_case/models.py
+++ b/tests/expressions_case/models.py
@@ -18,7 +18,6 @@ class CaseTestModel(models.Model):
big_integer = models.BigIntegerField(null=True)
binary = models.BinaryField(default=b'')
boolean = models.BooleanField(default=False)
- comma_separated_integer = models.CommaSeparatedIntegerField(max_length=100, default='')
date = models.DateField(null=True, db_column='date_field')
date_time = models.DateTimeField(null=True)
decimal = models.DecimalField(max_digits=2, decimal_places=1, null=True, db_column='decimal_field')
diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py
index 91806c2764..4617bcacb8 100644
--- a/tests/expressions_case/tests.py
+++ b/tests/expressions_case/tests.py
@@ -667,20 +667,6 @@ class CaseExpressionTests(TestCase):
transform=attrgetter('integer', 'boolean')
)
- def test_update_comma_separated_integer(self):
- CaseTestModel.objects.update(
- comma_separated_integer=Case(
- When(integer=1, then=Value('1')),
- When(integer=2, then=Value('2,2')),
- default=Value(''),
- ),
- )
- self.assertQuerysetEqual(
- CaseTestModel.objects.all().order_by('pk'),
- [(1, '1'), (2, '2,2'), (3, ''), (2, '2,2'), (3, ''), (3, ''), (4, '')],
- transform=attrgetter('integer', 'comma_separated_integer')
- )
-
def test_update_date(self):
CaseTestModel.objects.update(
date=Case(
diff --git a/tests/inspectdb/models.py b/tests/inspectdb/models.py
index 4b17c0444f..868f3ba4fe 100644
--- a/tests/inspectdb/models.py
+++ b/tests/inspectdb/models.py
@@ -50,7 +50,6 @@ class ColumnTypes(models.Model):
null_bool_field = models.NullBooleanField()
char_field = models.CharField(max_length=10)
null_char_field = models.CharField(max_length=10, blank=True, null=True)
- comma_separated_int_field = models.CommaSeparatedIntegerField(max_length=99)
date_field = models.DateField()
date_time_field = models.DateTimeField()
decimal_field = models.DecimalField(max_digits=6, decimal_places=1)
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py
index 83eda4a7de..daa0800d7c 100644
--- a/tests/inspectdb/tests.py
+++ b/tests/inspectdb/tests.py
@@ -60,7 +60,6 @@ class InspectDBTestCase(TestCase):
if not connection.features.interprets_empty_strings_as_nulls:
assertFieldType('char_field', "models.CharField(max_length=10)")
assertFieldType('null_char_field', "models.CharField(max_length=10, blank=True, null=True)")
- assertFieldType('comma_separated_int_field', "models.CharField(max_length=99)")
assertFieldType('email_field', "models.CharField(max_length=254)")
assertFieldType('file_field', "models.CharField(max_length=100)")
assertFieldType('file_path_field', "models.CharField(max_length=100)")
diff --git a/tests/invalid_models_tests/test_deprecated_fields.py b/tests/invalid_models_tests/test_deprecated_fields.py
index aca58cb607..ec713d95ff 100644
--- a/tests/invalid_models_tests/test_deprecated_fields.py
+++ b/tests/invalid_models_tests/test_deprecated_fields.py
@@ -29,12 +29,11 @@ class DeprecatedFieldsTests(SimpleTestCase):
model = CommaSeparatedIntegerModel()
self.assertEqual(
model.check(),
- [checks.Warning(
- 'CommaSeparatedIntegerField has been deprecated. Support '
- 'for it (except in historical migrations) will be removed '
- 'in Django 2.0.',
+ [checks.Error(
+ 'CommaSeparatedIntegerField is removed except for support in '
+ 'historical migrations.',
hint='Use CharField(validators=[validate_comma_separated_integer_list]) instead.',
obj=CommaSeparatedIntegerModel._meta.get_field('csi'),
- id='fields.W901',
+ id='fields.E901',
)],
)
diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py
index cd0f53c4f2..019301d5e2 100644
--- a/tests/model_fields/models.py
+++ b/tests/model_fields/models.py
@@ -163,28 +163,27 @@ class VerboseNameField(models.Model):
field1 = models.BigIntegerField("verbose field1")
field2 = models.BooleanField("verbose field2", default=False)
field3 = models.CharField("verbose field3", max_length=10)
- field4 = models.CommaSeparatedIntegerField("verbose field4", max_length=99)
- field5 = models.DateField("verbose field5")
- field6 = models.DateTimeField("verbose field6")
- field7 = models.DecimalField("verbose field7", max_digits=6, decimal_places=1)
- field8 = models.EmailField("verbose field8")
- field9 = models.FileField("verbose field9", upload_to="unused")
- field10 = models.FilePathField("verbose field10")
- field11 = models.FloatField("verbose field11")
+ field4 = models.DateField("verbose field4")
+ field5 = models.DateTimeField("verbose field5")
+ field6 = models.DecimalField("verbose field6", max_digits=6, decimal_places=1)
+ field7 = models.EmailField("verbose field7")
+ field8 = models.FileField("verbose field8", upload_to="unused")
+ field9 = models.FilePathField("verbose field9")
+ field10 = models.FloatField("verbose field10")
# Don't want to depend on Pillow in this test
# field_image = models.ImageField("verbose field")
- field12 = models.IntegerField("verbose field12")
- field13 = models.GenericIPAddressField("verbose field13", protocol="ipv4")
- field14 = models.NullBooleanField("verbose field14")
- field15 = models.PositiveIntegerField("verbose field15")
- field16 = models.PositiveSmallIntegerField("verbose field16")
- field17 = models.SlugField("verbose field17")
- field18 = models.SmallIntegerField("verbose field18")
- field19 = models.TextField("verbose field19")
- field20 = models.TimeField("verbose field20")
- field21 = models.URLField("verbose field21")
- field22 = models.UUIDField("verbose field22")
- field23 = models.DurationField("verbose field23")
+ field11 = models.IntegerField("verbose field11")
+ field12 = models.GenericIPAddressField("verbose field12", protocol="ipv4")
+ field13 = models.NullBooleanField("verbose field13")
+ field14 = models.PositiveIntegerField("verbose field14")
+ field15 = models.PositiveSmallIntegerField("verbose field15")
+ field16 = models.SlugField("verbose field16")
+ field17 = models.SmallIntegerField("verbose field17")
+ field18 = models.TextField("verbose field18")
+ field19 = models.TimeField("verbose field19")
+ field20 = models.URLField("verbose field20")
+ field21 = models.UUIDField("verbose field21")
+ field22 = models.DurationField("verbose field22")
class GenericIPAddress(models.Model):
@@ -322,7 +321,6 @@ class AllFieldsModel(models.Model):
binary = models.BinaryField()
boolean = models.BooleanField(default=False)
char = models.CharField(max_length=10)
- csv = models.CommaSeparatedIntegerField(max_length=10)
date = models.DateField()
datetime = models.DateTimeField()
decimal = models.DecimalField(decimal_places=2, max_digits=2)
diff --git a/tests/model_fields/test_promises.py b/tests/model_fields/test_promises.py
index c1b476e75e..65d1b7ec99 100644
--- a/tests/model_fields/test_promises.py
+++ b/tests/model_fields/test_promises.py
@@ -6,11 +6,10 @@ from decimal import Decimal
from django.db.models.fields import (
AutoField, BigIntegerField, BinaryField, BooleanField, CharField,
- CommaSeparatedIntegerField, DateField, DateTimeField, DecimalField,
- EmailField, FilePathField, FloatField, GenericIPAddressField, IntegerField,
- IPAddressField, NullBooleanField, PositiveIntegerField,
- PositiveSmallIntegerField, SlugField, SmallIntegerField, TextField,
- TimeField, URLField,
+ DateField, DateTimeField, DecimalField, EmailField, FilePathField,
+ FloatField, GenericIPAddressField, IntegerField, IPAddressField,
+ NullBooleanField, PositiveIntegerField, PositiveSmallIntegerField,
+ SlugField, SmallIntegerField, TextField, TimeField, URLField,
)
from django.db.models.fields.files import FileField, ImageField
from django.test import SimpleTestCase
@@ -43,12 +42,6 @@ class PromiseTest(SimpleTestCase):
lazy_func = lazy(lambda: 0, int)
self.assertIsInstance(CharField().get_prep_value(lazy_func()), six.text_type)
- def test_CommaSeparatedIntegerField(self):
- lazy_func = lazy(lambda: '1,2', six.text_type)
- self.assertIsInstance(CommaSeparatedIntegerField().get_prep_value(lazy_func()), six.text_type)
- lazy_func = lazy(lambda: 0, int)
- self.assertIsInstance(CommaSeparatedIntegerField().get_prep_value(lazy_func()), six.text_type)
-
def test_DateField(self):
lazy_func = lazy(lambda: datetime.date.today(), datetime.date)
self.assertIsInstance(DateField().get_prep_value(lazy_func()), datetime.date)
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 5869196335..76b3e5596a 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -42,7 +42,7 @@ class BasicFieldTests(TestCase):
def test_field_verbose_name(self):
m = VerboseNameField
- for i in range(1, 24):
+ for i in range(1, 23):
self.assertEqual(m._meta.get_field('field%d' % i).verbose_name, 'verbose field%d' % i)
self.assertEqual(m._meta.get_field('id').verbose_name, 'verbose pk')
diff --git a/tests/model_forms/models.py b/tests/model_forms/models.py
index f873cfea97..3675e080fa 100644
--- a/tests/model_forms/models.py
+++ b/tests/model_forms/models.py
@@ -218,14 +218,6 @@ except ImportError:
test_images = False
-@python_2_unicode_compatible
-class CommaSeparatedInteger(models.Model):
- field = models.CommaSeparatedIntegerField(max_length=20)
-
- def __str__(self):
- return self.field
-
-
class Homepage(models.Model):
url = models.URLField()
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index 1686629c3a..ef808f72f5 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -24,12 +24,12 @@ from django.utils._os import upath
from .models import (
Article, ArticleStatus, Author, Author1, Award, BetterWriter, BigInt, Book,
- Category, Character, Colour, ColourfulItem, CommaSeparatedInteger,
- CustomErrorMessage, CustomFF, CustomFieldForExclusionModel, DateTimePost,
- DerivedBook, DerivedPost, Document, ExplicitPK, FilePathModel,
- FlexibleDatePost, Homepage, ImprovedArticle, ImprovedArticleWithParentLink,
- Inventory, NullableUniqueCharFieldModel, Person, Photo, Post, Price,
- Product, Publication, PublicationDefaults, StrictAssignmentAll,
+ Category, Character, Colour, ColourfulItem, CustomErrorMessage, CustomFF,
+ CustomFieldForExclusionModel, DateTimePost, DerivedBook, DerivedPost,
+ Document, ExplicitPK, FilePathModel, FlexibleDatePost, Homepage,
+ ImprovedArticle, ImprovedArticleWithParentLink, Inventory,
+ NullableUniqueCharFieldModel, Person, Photo, Post, Price, Product,
+ Publication, PublicationDefaults, StrictAssignmentAll,
StrictAssignmentFieldSpecific, Student, StumpJoke, TextFile, Triple,
Writer, WriterProfile, test_images,
)
@@ -2411,35 +2411,6 @@ class ModelOtherFieldTests(SimpleTestCase):
self.assertFalse(bif.is_valid())
self.assertEqual(bif.errors, {'biggie': ['Ensure this value is less than or equal to 9223372036854775807.']})
- def test_comma_separated_integer_field(self):
- class CommaSeparatedIntegerForm(forms.ModelForm):
- class Meta:
- model = CommaSeparatedInteger
- fields = '__all__'
-
- f = CommaSeparatedIntegerForm({'field': '1'})
- self.assertTrue(f.is_valid())
- self.assertEqual(f.cleaned_data, {'field': '1'})
- f = CommaSeparatedIntegerForm({'field': '12'})
- self.assertTrue(f.is_valid())
- self.assertEqual(f.cleaned_data, {'field': '12'})
- f = CommaSeparatedIntegerForm({'field': '1,2,3'})
- self.assertTrue(f.is_valid())
- self.assertEqual(f.cleaned_data, {'field': '1,2,3'})
- f = CommaSeparatedIntegerForm({'field': '10,32'})
- self.assertTrue(f.is_valid())
- self.assertEqual(f.cleaned_data, {'field': '10,32'})
- f = CommaSeparatedIntegerForm({'field': '1a,2'})
- self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']})
- f = CommaSeparatedIntegerForm({'field': ',,,,'})
- self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']})
- f = CommaSeparatedIntegerForm({'field': '1.2'})
- self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']})
- f = CommaSeparatedIntegerForm({'field': '1,a,2'})
- self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']})
- f = CommaSeparatedIntegerForm({'field': '1,,2'})
- self.assertEqual(f.errors, {'field': ['Enter only digits separated by commas.']})
-
def test_url_on_modelform(self):
"Check basic URL field validation on model forms"
class HomepageForm(forms.ModelForm):
diff --git a/tests/model_inheritance_regress/models.py b/tests/model_inheritance_regress/models.py
index 07d5a22c9b..8481e21516 100644
--- a/tests/model_inheritance_regress/models.py
+++ b/tests/model_inheritance_regress/models.py
@@ -217,7 +217,6 @@ class Station(SearchableLocation):
class BusStation(Station):
- bus_routes = models.CommaSeparatedIntegerField(max_length=128)
inbound = models.BooleanField(default=False)
diff --git a/tests/runtests.py b/tests/runtests.py
index 6cec7d6e5c..a99ebd63c3 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -165,7 +165,6 @@ def setup(verbosity, test_labels, parallel):
settings.LOGGING = log_config
settings.SILENCED_SYSTEM_CHECKS = [
'fields.W342', # ForeignKey(unique=True) -> OneToOneField
- 'fields.W901', # CommaSeparatedIntegerField deprecated
]
# Load all the ALWAYS_INSTALLED_APPS.