1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #8023 -- Allow filtering of DecimalFields (in models) using strings.

At the same time, checked all other cases of db_prep_value() to ensure they
aren't making the same mistake.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2008-07-30 00:18:49 +00:00
parent 1ba2d6888f
commit 281f2b74bf
2 changed files with 16 additions and 5 deletions

View File

@@ -732,8 +732,8 @@ class DecimalField(Field):
return util.format_number(value, self.max_digits, self.decimal_places)
def get_db_prep_value(self, value):
return connection.ops.value_to_db_decimal(value, self.max_digits,
self.decimal_places)
return connection.ops.value_to_db_decimal(self.to_python(value),
self.max_digits, self.decimal_places)
def get_manipulator_field_objs(self):
return [curry(oldforms.DecimalField, max_digits=self.max_digits, decimal_places=self.decimal_places)]