Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DecimalField value is not converted correctly #69

Closed
maxirobaina opened this issue Apr 6, 2017 · 0 comments
Closed

DecimalField value is not converted correctly #69

maxirobaina opened this issue Apr 6, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@maxirobaina
Copy link
Owner

This is a regression bug in django-firebird 1.8
Django 1.7 has a in operations a convert_values method which convert the returned value from db driver to a representative python type (according with model field definition). In that implementation on django-firebird 1.7 a DecimalField was adpated to correct decimal format.
In django-firebird 1.8, with the new get_db_converters and convert_FIELDTYPE_value methods the decimal formating was lost.

Then, by example:

class ModelWithDecimalFileld(models.Model):
    price = models.DecimalField(max_digits=18, decimal_places=2, default=0)

If we have an instance with price = 1990.00

In django-firebird 1.7

>> obj = ModelWithDecimalFileld.objects.first()
>> obj.price
>> Decimal("1990.00")

In django-firebird 1.8

>> obj = ModelWithDecimalFileld.objects.first()
>> obj.price
>> Decimal("1990")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant