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
37f7f233
Kaydet (Commit)
37f7f233
authored
Mar 14, 2014
tarafından
Baptiste Mispelon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22272 -- Fixed regression in DecimalField when using decimal_places=0.
Thanks to trac user merb for the report.
üst
666a2ad2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
__init__.py
django/db/models/fields/__init__.py
+2
-2
tests.py
tests/field_deconstruction/tests.py
+10
-0
No files found.
django/db/models/fields/__init__.py
Dosyayı görüntüle @
37f7f233
...
...
@@ -1379,9 +1379,9 @@ class DecimalField(Field):
def
deconstruct
(
self
):
name
,
path
,
args
,
kwargs
=
super
(
DecimalField
,
self
)
.
deconstruct
()
if
self
.
max_digits
:
if
self
.
max_digits
is
not
None
:
kwargs
[
'max_digits'
]
=
self
.
max_digits
if
self
.
decimal_places
:
if
self
.
decimal_places
is
not
None
:
kwargs
[
'decimal_places'
]
=
self
.
decimal_places
return
name
,
path
,
args
,
kwargs
...
...
tests/field_deconstruction/tests.py
Dosyayı görüntüle @
37f7f233
...
...
@@ -110,6 +110,16 @@ class FieldDeconstructionTests(TestCase):
self
.
assertEqual
(
args
,
[])
self
.
assertEqual
(
kwargs
,
{
"max_digits"
:
5
,
"decimal_places"
:
2
})
def
test_decimal_field_0_decimal_places
(
self
):
"""
A DecimalField with decimal_places=0 shoudl work (#22272).
"""
field
=
models
.
DecimalField
(
max_digits
=
5
,
decimal_places
=
0
)
name
,
path
,
args
,
kwargs
=
field
.
deconstruct
()
self
.
assertEqual
(
path
,
"django.db.models.DecimalField"
)
self
.
assertEqual
(
args
,
[])
self
.
assertEqual
(
kwargs
,
{
"max_digits"
:
5
,
"decimal_places"
:
0
})
def
test_email_field
(
self
):
field
=
models
.
EmailField
()
name
,
path
,
args
,
kwargs
=
field
.
deconstruct
()
...
...
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