We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
dash-core-components 2.0.0 dash-extensions 1.0.18 dash-html-components 2.0.0 dash-table 5.0.0
When modifying the example from this link: https://www.dash-extensions.com/transforms/dataclass_transform as:
from datetime import datetime from typing import Optional from dash_extensions.enrich import ( DashProxy, DataclassTransform, Input, Output, State, dcc, html, ) @dataclass class Person: name: str date_of_birth: datetime app = DashProxy(transforms=[DataclassTransform()]) app.layout = html.Div( [ dcc.Input(id="name", value="John Doe"), dcc.DatePickerSingle(id="picker", date=datetime(1990, 1, 1)), dcc.Store(id="store"), html.Button("Submit", id="btn"), html.Div(id="log"), ] ) @app.callback( Input("btn", "n_clicks"), State("name", "value"), State("picker", "date"), Output("store", "data"), ) def submit(_, name, date): dt = datetime.fromisoformat(date) return Person(name, dt) # no (manual) serialization here @app.callback( Output("log", "children"), Input("store", "data"), ) def log(person: Optional[Person]): return f"{person.name} was born on {person.date_of_birth}" # no (manual) deserialization here if __name__ == "__main__": app.run_server(port=8060)
The object returned from the "submit" function is a dict (not serialised).
The text was updated successfully, but these errors were encountered:
I believe I got it to work by changing the _try_load method for DataclassTransform - if this is something desirable I could create a PR
Sorry, something went wrong.
No branches or pull requests
When modifying the example from this link: https://www.dash-extensions.com/transforms/dataclass_transform as:
The object returned from the "submit" function is a dict (not serialised).
The text was updated successfully, but these errors were encountered: