class UserSchema(ma.Schema):
class Meta:
# Fields to expose
fields = ("email", "date_created", "_links")
# Smart hyperlinking
_links = ma.Hyperlinks(
{
"self": ma.URLFor("user_detail", values=dict(id="<id>")),
"collection": ma.URLFor("users"),
}
)
user_schema = UserSchema()
users_schema = UserSchema(many=True)