|
I have a model with a However, in the admin panel, it is converted and treated as Is there a way to override the original form? I envision a form having several number Where should I start looking into? |
Answered by
jowilf
Aug 28, 2024
Replies: 1 comment 2 replies
|
The interval is treated as datetime due to the You can create a custom field and add a converter for it. Here is how you can do it class MyCustomIntervalField(BaseField):
....
class MyCustomConverter(ModelConverter): # from sqla.converters
@converts("Interval")
def conv_interval(self, *args: Any, **kwargs: Any) -> BaseField:
return MyCustomIntervalField(... )
admin.add_view(ModelView(MyModel, converter=MyCustomConverter()))For more info:
Also feel free to contribute back, it would be good to have a field for Interval by default |
2 replies
Answer selected by
regisin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The interval is treated as datetime due to the
implattribute in the Interval type which is Datetime.You can create a custom field and add a converter for it. Here is how you can do it
For more info:
Also feel fr…