From 13cd6637f56d72d1fbe6e7ce72af95edd11dbd97 Mon Sep 17 00:00:00 2001 From: boke0 Date: Tue, 23 Mar 2021 22:29:58 +0900 Subject: [PATCH] fix --- mitama/db/model.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mitama/db/model.py b/mitama/db/model.py index e9514aa..46bec7c 100755 --- a/mitama/db/model.py +++ b/mitama/db/model.py @@ -110,11 +110,12 @@ def listen(cls, evt): cls.event.listen(evt) @classmethod - def list(cls, *args): - if len(args) > 0: - return cls.query.filter(args).all() - else: - return cls.query.filter().all() + def list(cls, **kwargs): + q = cls.query + if len(kwargs) > 0: + for attr, value in kwargs.items(): + q = q.filter(getattr(cls, attr) == value) + return q.all() @classmethod def retrieve(cls, id=None, **kwargs):