Skip to content

Instantly share code, notes, and snippets.

View ricardotenv's full-sized avatar
🏠
Working from home

Ricardo Santos ricardotenv

🏠
Working from home
View GitHub Profile
@alexandre
alexandre / learn_path.md
Last active December 9, 2023 23:13
Um guia para estudar python do básico ao intermediário (meu nível) utilizando alguns livros e outros recursos
@corydolphin
corydolphin / mongoengine_jsonencoder.py
Last active August 9, 2021 17:57
Fix: TypeError: ObjectId is not JSON serializable: A Flask JSONEncoder for Mongoengine documents. Specifically useful for use with Flask-Mongoengine.
from flask import Flask
from flask.json import JSONEncoder
from bson import json_util
from mongoengine.base import BaseDocument
from mongoengine.queryset.base import BaseQuerySet
class MongoEngineJSONEncoder(JSONEncoder):
def default(self,obj):
if isinstance(obj,BaseDocument):
return json_util._json_convert(obj.to_mongo())