dict -> model_dump and field_info fixes
This commit is contained in:
parent
b65c34b212
commit
b565e8934a
@ -348,7 +348,7 @@ class Select(Component):
|
|||||||
converted_options.append(Option(label=str(option), value=option))
|
converted_options.append(Option(label=str(option), value=option))
|
||||||
else:
|
else:
|
||||||
converted_options.append(option)
|
converted_options.append(option)
|
||||||
props["options"] = [o.dict() for o in converted_options]
|
props["options"] = [o.model_dump() for o in converted_options]
|
||||||
else:
|
else:
|
||||||
props["options"] = options
|
props["options"] = options
|
||||||
return super().create(*[], **props)
|
return super().create(*[], **props)
|
||||||
|
@ -225,7 +225,7 @@ class Editor(NoSSRComponent):
|
|||||||
raise ValueError("EditorOptions cannot be a state Var")
|
raise ValueError("EditorOptions cannot be a state Var")
|
||||||
props["set_options"] = {
|
props["set_options"] = {
|
||||||
to_camel_case(k): v
|
to_camel_case(k): v
|
||||||
for k, v in set_options.dict().items()
|
for k, v in set_options.model_dump().items()
|
||||||
if v is not None
|
if v is not None
|
||||||
}
|
}
|
||||||
return super().create(*[], **props)
|
return super().create(*[], **props)
|
||||||
|
@ -262,7 +262,7 @@ class CallableEventSpec(EventSpec):
|
|||||||
default_event_spec = fn()
|
default_event_spec = fn()
|
||||||
super().__init__(
|
super().__init__(
|
||||||
fn=fn, # type: ignore
|
fn=fn, # type: ignore
|
||||||
**default_event_spec.dict(),
|
**default_event_spec.model_dump(),
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -63,7 +63,7 @@ class Model(Base, sqlmodel.SQLModel):
|
|||||||
field_name
|
field_name
|
||||||
for field_name, field in cls.model_fields.items()
|
for field_name, field in cls.model_fields.items()
|
||||||
if field_name != "id"
|
if field_name != "id"
|
||||||
and getattr(field.field_info, "primary_key", None) is True
|
and getattr(field, "primary_key", None) is True
|
||||||
]
|
]
|
||||||
if non_default_primary_key_fields:
|
if non_default_primary_key_fields:
|
||||||
cls.model_fields.pop("id", None)
|
cls.model_fields.pop("id", None)
|
||||||
|
@ -199,7 +199,7 @@ class VarData(Base):
|
|||||||
"state": self.state,
|
"state": self.state,
|
||||||
"interpolations": list(self.interpolations),
|
"interpolations": list(self.interpolations),
|
||||||
"imports": {
|
"imports": {
|
||||||
lib: [import_var.dict() for import_var in import_vars]
|
lib: [import_var.model_dump() for import_var in import_vars]
|
||||||
for lib, import_vars in self.imports.items()
|
for lib, import_vars in self.imports.items()
|
||||||
},
|
},
|
||||||
"hooks": list(self.hooks),
|
"hooks": list(self.hooks),
|
||||||
|
Loading…
Reference in New Issue
Block a user