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

form_type_formatters #673

Open
1 task done
plsholdmybeer opened this issue Nov 14, 2023 · 0 comments
Open
1 task done

form_type_formatters #673

plsholdmybeer opened this issue Nov 14, 2023 · 0 comments

Comments

@plsholdmybeer
Copy link
Contributor

plsholdmybeer commented Nov 14, 2023

Checklist

  • There are no similar issues or pull requests for this yet.

Is your feature related to a problem? Please describe.

Decimals tend to be displayed as 0e-10 everywhere (reference for potential research: django had this problem)

I'm working around this issue by making my own ModelView, this fixes the value in table views.

from sqladmin.formatters import BASE_FORMATTERS
class ModelView(ModelView):
    column_type_formatters = BASE_FORMATTERS | {Decimal: float}  # type: ignore

But issue remains within edit/creating forms, something like form_type_formatters would fix it there as well.
image

Describe the solution you would like.

form_type_formatters that works like existing column_type_formatters, but for the edit/create form.

Describe alternatives you considered

Possibly adding {Decimal: float} to BASE_FORMATTERS would prevent other people from having similar issue in future (for the table issue, not the form issue though, I haven't figured out that one yet)

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant