peewee-ext is a peewee extension
Project description
Peewee-ext
简介
peewee-ext 对 peewee 进行了部分扩展,在其基础上进行了增强
安装
pip install peewee-ext
说明
增加一个 DictModel 增加两个方法
from peewee import Model
class DictModel(Model):
def to_data(self, recurse=True, backrefs=False,
only=None, exclude=None,
seen=None, extra_attrs=None,
fields_from_query=None, max_depth=None,
manytomany=False):
"""model to dict"""
def to_dict(self):
"""model to dict"""
def __str__(self):
"""friendly for human"""
增加两个装饰器
def to_dict(func):
"""
model to dict , shallow convert
"""
# 返回嵌套字典
def to_data(func=None, recurse=True, backrefs=False,
only=None, exclude=None,
seen=None, extra_attrs=None,
fields_from_query=None, max_depth=1,
manytomany=False):
"""model to dict , deep convert"""
增加执行时间打印
from peewee import MySQLDatabase
class TimerMySQLDatabase(MySQLDatabase):
""""""
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
peewee-ext-0.0.1.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for peewee_ext-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29fea598a8adc7d0e6015a158b562435f44ccdca7c111b14a872d728b1c1fab5 |
|
MD5 | 30a2d36e357bb01bb7e68a6df69271eb |
|
BLAKE2b-256 | ef7abeeae258442bf068efe62c2f1c0075d83cca816a124fdabd3b4acf4ad608 |