Skip to content
Discussion options

You must be logged in to vote

The interval is treated as datetime due to the impl attribute 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

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 fr…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@regisin
Comment options

@regisin
Comment options

Answer selected by regisin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants