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
DecimalBlock values become strings #4647
Comments
Another workaround |
Probably still happening but should be validated. Good first issue label and other labels added. Whoever wants to pick this up should start looking at this code. https://github.com/wagtail/wagtail/blob/main/wagtail/blocks/field_block.py Most likely the value being shown in the Preview is based on the field widget but the value from the DB is from JSON and maybe not getting correctly parsed when pulled back out.
|
I have validated this on the wagtail main branch (short after 3.0 release) not an Issue anymore. With this template code:
I get this in the bakery demo, looks right update: |
Hi @yvess, I'll open a PR against your bakerydemo fork with this additional code. (edit: opened now yvess/wagtail-bakerydemo#1) |
Issue Summary
DecimalBlock values work as expected when previewing a page, however they become strings when the published page is rendered.
Steps to Reproduce
register.filter(name='type')(lambda v: type(v))
{{ value.some_decimal_field|type }}
<class 'decimal.Decimal'>
<class 'str'>
(As a quick fix I've just added
|add:0
because that converts it to a number.)Technical details
The text was updated successfully, but these errors were encountered: