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
fdccc025
Kaydet (Commit)
fdccc025
authored
Şub 16, 2016
tarafından
Akshesh
Kaydeden (comit)
Tim Graham
Şub 17, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26219 -- Fixed crash when filtering by Decimal in RawQuery.
üst
88034c99
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletion
+11
-1
operations.py
django/db/backends/base/operations.py
+1
-1
1.9.3.txt
docs/releases/1.9.3.txt
+3
-0
models.py
tests/raw_query/models.py
+1
-0
tests.py
tests/raw_query/tests.py
+6
-0
No files found.
django/db/backends/base/operations.py
Dosyayı görüntüle @
fdccc025
...
...
@@ -486,7 +486,7 @@ class BaseDatabaseOperations(object):
raise
ValueError
(
"Django does not support timezone-aware times."
)
return
six
.
text_type
(
value
)
def
adapt_decimalfield_value
(
self
,
value
,
max_digits
,
decimal_places
):
def
adapt_decimalfield_value
(
self
,
value
,
max_digits
=
None
,
decimal_places
=
None
):
"""
Transforms a decimal.Decimal value to an object compatible with what is
expected by the backend driver for decimal (numeric) columns.
...
...
docs/releases/1.9.3.txt
Dosyayı görüntüle @
fdccc025
...
...
@@ -31,3 +31,6 @@ Bugfixes
* Fixed :class:`~django.contrib.postgres.fields.RangeField` and
:class:`~django.contrib.postgres.fields.ArrayField` serialization with
``None`` values (:ticket:`26215`).
* Fixed a crash when filtering by a ``Decimal`` in ``RawQuery``
(:ticket:`26219`).
tests/raw_query/models.py
Dosyayı görüntüle @
fdccc025
...
...
@@ -29,6 +29,7 @@ class BookFkAsPk(models.Model):
class
Coffee
(
models
.
Model
):
brand
=
models
.
CharField
(
max_length
=
255
,
db_column
=
"name"
)
price
=
models
.
DecimalField
(
max_digits
=
10
,
decimal_places
=
2
,
default
=
0
)
class
Reviewer
(
models
.
Model
):
...
...
tests/raw_query/tests.py
Dosyayı görüntüle @
fdccc025
from
__future__
import
unicode_literals
from
datetime
import
date
from
decimal
import
Decimal
from
django.db.models.query_utils
import
InvalidQuery
from
django.test
import
TestCase
,
skipUnlessDBFeature
...
...
@@ -307,3 +308,8 @@ class RawQueryTests(TestCase):
"""
b
=
BookFkAsPk
.
objects
.
create
(
book
=
self
.
b1
)
self
.
assertEqual
(
list
(
BookFkAsPk
.
objects
.
raw
(
'SELECT not_the_default FROM raw_query_bookfkaspk'
)),
[
b
])
def
test_decimal_parameter
(
self
):
c
=
Coffee
.
objects
.
create
(
brand
=
'starbucks'
,
price
=
20.5
)
qs
=
Coffee
.
objects
.
raw
(
"SELECT * FROM raw_query_coffee WHERE price >=
%
s"
,
params
=
[
Decimal
(
20
)])
self
.
assertEqual
(
list
(
qs
),
[
c
])
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