sqladmin
sqladmin copied to clipboard
form_type_formatters
Checklist
- [X] 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.
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