You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In WorkerOut ModelSchema bellow I am not get to work pydantic field resolve_runtime_sec that converts timedelta orm field to seconds.
For debug purposes I added a row that works correctly.
Thanks,
H.
class WorkerOut(ModelSchema):
runtime_sec: float = Field(0)
@staticmethod
def resolve_runtime_sec(obj) -> float:
# print(obj.runtime.total_seconds()) # a debug row - a timedelta method that prints seconds correctly
return obj.runtime.total_seconds()
class Meta:
model = Worker
exclude = [
"id",
"runtime",
]
Python version: 3.12
Django version: 5.1
Django-Ninja version: 1.3
Pydantic version: 2.10
The text was updated successfully, but these errors were encountered:
In WorkerOut ModelSchema bellow I am not get to work pydantic field resolve_runtime_sec that converts timedelta orm field to seconds.
For debug purposes I added a row that works correctly.
Thanks,
H.
The text was updated successfully, but these errors were encountered: