Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
dca8b916
Kaydet (Commit)
dca8b916
authored
Şub 07, 2016
tarafından
Brobin
Kaydeden (comit)
Tim Graham
Şub 10, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26154 -- Deprecated CommaSeparatedIntegerField
üst
f7a9872b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
1 deletion
+62
-1
__init__.py
django/db/models/fields/__init__.py
+11
-0
deprecation.txt
docs/internals/deprecation.txt
+3
-0
checks.txt
docs/ref/checks.txt
+2
-0
fields.txt
docs/ref/models/fields.txt
+6
-1
1.10.txt
docs/releases/1.10.txt
+23
-0
test_deprecated_fields.py
tests/invalid_models_tests/test_deprecated_fields.py
+17
-0
No files found.
django/db/models/fields/__init__.py
Dosyayı görüntüle @
dca8b916
...
...
@@ -1144,6 +1144,17 @@ class CharField(Field):
class
CommaSeparatedIntegerField
(
CharField
):
default_validators
=
[
validators
.
validate_comma_separated_integer_list
]
description
=
_
(
"Comma-separated integers"
)
system_check_deprecated_details
=
{
'msg'
:
(
'CommaSeparatedIntegerField has been deprecated. Support '
'for it (except in historical migrations) will be removed '
'in Django 2.0.'
),
'hint'
:
(
'Use CharField(validators=[validate_comma_separated_integer_list]) instead.'
),
'id'
:
'fields.W901'
,
}
def
formfield
(
self
,
**
kwargs
):
defaults
=
{
...
...
docs/internals/deprecation.txt
Dosyayı görüntüle @
dca8b916
...
...
@@ -130,6 +130,9 @@ details on these changes.
* The ``django.core.urlresolvers`` module will be removed.
* The model ``CommaSeparatedIntegerField`` will be removed. A stub field will
remain for compatibility with historical migrations.
.. _deprecation-removed-in-1.10:
1.10
...
...
docs/ref/checks.txt
Dosyayı görüntüle @
dca8b916
...
...
@@ -165,6 +165,8 @@ Fields
* **fields.W900**: ``IPAddressField`` has been deprecated. Support for it
(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.
File Fields
~~~~~~~~~~~
...
...
docs/ref/models/fields.txt
Dosyayı görüntüle @
dca8b916
...
...
@@ -471,12 +471,17 @@ 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.
...
...
docs/releases/1.10.txt
Dosyayı görüntüle @
dca8b916
...
...
@@ -561,6 +561,29 @@ This prevents confusion about an assignment resulting in an implicit save.
:class:`~django.contrib.gis.geos.MultiPolygon` is deprecated in favor of the
:attr:`~django.contrib.gis.geos.GEOSGeometry.unary_union` property.
``CommaSeparatedIntegerField`` model field
------------------------------------------
``CommaSeparatedIntegerField`` is deprecated in favor of
:class:`~django.db.models.CharField` with the
:func:`~django.core.validators.validate_comma_separated_integer_list`
validator::
from django.core.validators import validate_comma_separated_integer_list
from django.db import models
class MyModel(models.Model):
numbers = models.CharField(..., validators=[validate_comma_separated_integer_list])
If you're using Oracle, ``CharField`` uses a different database field type
(``NVARCHAR2``) than ``CommaSeparatedIntegerField`` (``VARCHAR2``). Depending
on your database settings, this might imply a different encoding, and thus a
different length (in bytes) for the same contents. If your stored values are
longer than the 4000 byte limit of ``NVARCHAR2``, you should use ``TextField``
(``NCLOB``) instead. In this case, if you have any queries that group by the
field (e.g. annotating the model with an aggregation or using ``distinct()``)
you'll need to change them (to defer the field).
Miscellaneous
-------------
...
...
tests/invalid_models_tests/test_deprecated_fields.py
Dosyayı görüntüle @
dca8b916
...
...
@@ -21,3 +21,20 @@ class DeprecatedFieldsTests(SimpleTestCase):
id
=
'fields.E900'
,
)],
)
def
test_CommaSeparatedIntegerField_deprecated
(
self
):
class
CommaSeparatedIntegerModel
(
models
.
Model
):
csi
=
models
.
CommaSeparatedIntegerField
(
max_length
=
64
)
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.'
,
hint
=
'Use CharField(validators=[validate_comma_separated_integer_list]) instead.'
,
obj
=
CommaSeparatedIntegerModel
.
_meta
.
get_field
(
'csi'
),
id
=
'fields.W901'
,
)],
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment