import datetime as dt from marshmallow import Schema, fields class Transaction(): def __init__(self, description, amount, type): self.description = description self.amount = amount self.created_at = dt.datetime.now() self.type = type def __repr__(self): return '<Transaction(name={self.description!r})>'.format(self=self) class TransactionSchema(Schema): description = fields.Str() amount = fields.Number() created_at = fields.Date() type = fields.Str()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter