preload
This commit is contained in:
parent
4c4fc87647
commit
e6391e9fe6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user