From d650750ac7007339ad641910586312132b702c54 Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 22 Oct 2022 21:38:31 +0300 Subject: [PATCH] super load --- helpers/models.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/helpers/models.py b/helpers/models.py index 9ad46c0..4bb86a0 100644 --- a/helpers/models.py +++ b/helpers/models.py @@ -31,8 +31,7 @@ USchema = marshmallow_dataclass.class_schema(User) class UserSchema(USchema): - @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 + def load(self, entity, *args, **kwargs): + if 'next_daily_notify_time' in entity: + entity['next_daily_notify_time'] = str(entity['next_daily_notify_time']) + return super().load(entity, *args, **kwargs)