summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/raw_query/models.py1
-rw-r--r--tests/raw_query/tests.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/raw_query/models.py b/tests/raw_query/models.py
index fd122d4dbe..6e996322cc 100644
--- a/tests/raw_query/models.py
+++ b/tests/raw_query/models.py
@@ -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):
diff --git a/tests/raw_query/tests.py b/tests/raw_query/tests.py
index 2f80c23f32..5bda4d76b6 100644
--- a/tests/raw_query/tests.py
+++ b/tests/raw_query/tests.py
@@ -1,6 +1,7 @@
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
@@ -306,3 +307,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])