Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
boke0 committed Mar 23, 2021
1 parent 1177f44 commit 13cd663
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mitama/db/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 13cd663

Please sign in to comment.