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
5bcca2a0
Kaydet (Commit)
5bcca2a0
authored
Eyl 03, 2017
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #27532 -- Removed Model._meta.has_auto_field per deprecation timeline.
üst
48d57788
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
37 deletions
+2
-37
options.py
django/db/models/options.py
+0
-15
2.1.txt
docs/releases/2.1.txt
+2
-0
test_removedindjango21.py
tests/model_meta/test_removedindjango21.py
+0
-22
No files found.
django/db/models/options.py
Dosyayı görüntüle @
5bcca2a0
import
copy
import
copy
import
inspect
import
inspect
import
warnings
from
bisect
import
bisect
from
bisect
import
bisect
from
collections
import
OrderedDict
,
defaultdict
from
collections
import
OrderedDict
,
defaultdict
...
@@ -13,7 +12,6 @@ from django.db.models.fields import AutoField
...
@@ -13,7 +12,6 @@ from django.db.models.fields import AutoField
from
django.db.models.fields.proxy
import
OrderWrt
from
django.db.models.fields.proxy
import
OrderWrt
from
django.db.models.query_utils
import
PathInfo
from
django.db.models.query_utils
import
PathInfo
from
django.utils.datastructures
import
ImmutableList
,
OrderedSet
from
django.utils.datastructures
import
ImmutableList
,
OrderedSet
from
django.utils.deprecation
import
RemovedInDjango21Warning
from
django.utils.functional
import
cached_property
from
django.utils.functional
import
cached_property
from
django.utils.text
import
camel_case_to_spaces
,
format_lazy
from
django.utils.text
import
camel_case_to_spaces
,
format_lazy
from
django.utils.translation
import
override
from
django.utils.translation
import
override
...
@@ -818,19 +816,6 @@ class Options:
...
@@ -818,19 +816,6 @@ class Options:
self
.
_get_fields_cache
[
cache_key
]
=
fields
self
.
_get_fields_cache
[
cache_key
]
=
fields
return
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
@cached_property
def
_property_names
(
self
):
def
_property_names
(
self
):
"""Return a set of the names of the properties defined on the model."""
"""Return a set of the names of the properties defined on the model."""
...
...
docs/releases/2.1.txt
Dosyayı görüntüle @
5bcca2a0
...
@@ -254,3 +254,5 @@ how to remove usage of these features.
...
@@ -254,3 +254,5 @@ how to remove usage of these features.
* The ``USE_ETAGS`` setting is removed. ``CommonMiddleware`` and
* The ``USE_ETAGS`` setting is removed. ``CommonMiddleware`` and
``django.utils.cache.patch_response_headers()`` no longer set ETags.
``django.utils.cache.patch_response_headers()`` no longer set ETags.
* The ``Model._meta.has_auto_field`` attribute is removed.
tests/model_meta/test_removedindjango21.py
deleted
100644 → 0
Dosyayı görüntüle @
48d57788
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
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