diff options
author | Michaël Ball <michael.ball@gmail.com> | 2014-12-28 12:24:22 +0000 |
---|---|---|
committer | Michaël Ball <michael.ball@gmail.com> | 2015-11-27 20:02:04 +0000 |
commit | 75beec91a8526fbbc0a90134140b9dff6af15c0c (patch) | |
tree | 02414e46da3e08000384c40c27b7aab9748de0fe /models/album.py | |
parent | a2964845e3c03b9cf5f01583f53f7553c7d67caf (diff) |
Initial frontend work
Diffstat (limited to 'models/album.py')
-rw-r--r-- | models/album.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/models/album.py b/models/album.py index 9ca3798..0d7cd54 100644 --- a/models/album.py +++ b/models/album.py @@ -99,7 +99,8 @@ class Album(): sql = " ".join(("UPDATE album"), set_clause, "WHERE id = :id") cursor.execute(sql, dirty_attributes) - def search(**search_params): + def search(order="album.id", direction="ASC", limit=None, + offset=None, **search_params): """Find an album with the given params Args: @@ -117,7 +118,14 @@ class Album(): value_params = {} for (attr, value) in search_params.items(): where_params[attr] = value["operator"] - value_params[attr] = value["data"] + + if value["operator"] == "BETWEEN": + items = value["data"].split(" ") + + value_params["".join((attr, "1"))] = items[0] + value_params["".join((attr, "2"))] = items[2] + else: + value_params[attr] = value["data"] where_clause = utils.make_where_clause(where_params) @@ -138,6 +146,7 @@ class Album(): def all(order="album.id", direction="ASC", limit=None, offset=None): db = DbManager() cursor = db.cursor() + albums = [] select_string = """SELECT * FROM album LEFT JOIN album_artist ON |