#26219: Cannot filter by DecimalField in RawQuery
-------------------------------------+-------------------------------------
Reporter: jirek | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.9
(models, ORM) |
Severity: Normal | Resolution:
Keywords: DecimalField | Triage Stage: Accepted
RawQuery |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by jarshwah):
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
Yep, this is indeed a bug. The following patch seems to fix the problem,
but I haven't run the test suite to verify no bad behaviour is introduced.
This is probably a regression introduced in 1.8 (I think). I remember
modifying this code around then.
{{{
diff --git a/django/db/backends/base/operations.py
b/django/db/backends/base/operations.py
index 7957265..10641bf 100644
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -485,7 +485,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.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26219#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.33828526091d2de818ea7a98add070b9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.