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

Decimal field gets overwritten by big decimal number #1425

Open
Yodale1000 opened this issue Apr 19, 2022 · 6 comments
Open

Decimal field gets overwritten by big decimal number #1425

Yodale1000 opened this issue Apr 19, 2022 · 6 comments
Labels

Comments

@Yodale1000
Copy link

grafik

@Yodale1000 Yodale1000 added the bug label Apr 19, 2022
@Yodale1000
Copy link
Author

Yodale1000 commented Apr 19, 2022

The number in the xlsx file is 1803,60

@matthewhegarty
Copy link
Contributor

matthewhegarty commented Apr 19, 2022

  • What type is the underlying model field?
  • Have you declared this field in your resource? If so, what widget type have you used (if any)?
  • The value is definitely 1803,60 ? (I get decimal.ConversionSyntax when trying to import this value)
  • What version of django-import-export / django are you using?

If you could include steps to reproduce in the test app that would be very helpful.

@matthewhegarty
Copy link
Contributor

matthewhegarty commented Apr 19, 2022

I tried importing an XLSX field (Book "price" ) with a value of 1803.60 (I set the format to '0.00'). On, import the confirm screen implies that the trailing '0' will be lost on import which seems incorrect, because the value has not changed:

import1

@Yodale1000
Copy link
Author

mode field: raw_requirement = models.DecimalField( verbose_name="Rohbedarf", max_digits=8, decimal_places=2, blank=True, null=True )
resource field: raw_requirement = fields.Field(column_name="Rohbedarf", attribute="raw_requirement")
actual value in xlsx file: 1803,60 (cell formated as number)
version of django / django-import-export: 4.0.2 / 2.8.0

@matthewhegarty
Copy link
Contributor

Can you confirm that when it is imported to the db the value is correct? (you have decimal_places set to 2)?

@Yodale1000
Copy link
Author

Yes the value from the xlsx file gets saved correctly to the db. Apparently it is only wrong while importing.

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

2 participants