From 75beec91a8526fbbc0a90134140b9dff6af15c0c Mon Sep 17 00:00:00 2001 From: Michaƫl Ball Date: Sun, 28 Dec 2014 12:24:22 +0000 Subject: Initial frontend work --- models/album.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'models/album.py') 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 -- cgit v1.2.3