Hi!
I have such model:
class User(BaseModel, UserMixin):
birth_date = DateField(null=True)
......
And when I try to do this:
model_to_dict(current_user)
I'm getting this error:
TypeError: datetime.date(1989, 8, 9) is not JSON serializable
But model_to_dict doesn't do any json serialization?
Sorry. found the reason it was another
alexpantyukhin , what was the reason? I am having the same problem.
model_to_dict returns a dict, not a JSON object, so I'm not sure what the confusion is about.
Sorry, model_to_dict is working as expected. I am making a confusion here.
I am trying to use json.dumps in a dictionary returned by model_to_dict, and it is failing (as expected).
The solution is not related to peewee code.
Sorry for this unnecessary message!