diff --git a/helpers/models.py b/helpers/models.py index 6c3391e..9ad46c0 100644 --- a/helpers/models.py +++ b/helpers/models.py @@ -3,7 +3,7 @@ from dataclasses import dataclass from typing import Optional import marshmallow_dataclass -from marshmallow import EXCLUDE, post_load +from marshmallow import EXCLUDE, pre_load @dataclass @@ -26,14 +26,13 @@ class Lesson: hse_id: int - USchema = marshmallow_dataclass.class_schema(User) class UserSchema(USchema): - @post_load - def stringify_time(self, in_data, **kwargs): - if 'next_daily_notify_time' in in_data: - in_data['next_daily_notify_time'] = str(in_data['next_daily_notify_time']) - return in_data + @pre_load + def stringify_time(self, data, many, **kwargs): + if 'next_daily_notify_time' in data: + data['next_daily_notify_time'] = str(data['next_daily_notify_time']) + return data