This commit is contained in:
Administrator 2022-10-22 20:59:06 +03:00
parent 4c4fc87647
commit e6391e9fe6

View File

@ -3,7 +3,7 @@ from dataclasses import dataclass
from typing import Optional from typing import Optional
import marshmallow_dataclass import marshmallow_dataclass
from marshmallow import EXCLUDE, post_load from marshmallow import EXCLUDE, pre_load
@dataclass @dataclass
@ -26,14 +26,13 @@ class Lesson:
hse_id: int hse_id: int
USchema = marshmallow_dataclass.class_schema(User) USchema = marshmallow_dataclass.class_schema(User)
class UserSchema(USchema): class UserSchema(USchema):
@post_load @pre_load
def stringify_time(self, in_data, **kwargs): def stringify_time(self, data, many, **kwargs):
if 'next_daily_notify_time' in in_data: if 'next_daily_notify_time' in data:
in_data['next_daily_notify_time'] = str(in_data['next_daily_notify_time']) data['next_daily_notify_time'] = str(data['next_daily_notify_time'])
return in_data return data