From f961eba9bfc4c7b355b34dd17b4f07ae60cd11bf Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Wed, 13 Jan 2016 18:33:21 +0100 Subject: [PATCH] Rename parameter account to account_id. --- accountant/api/views/operations.py | 4 ++-- accountant/api/views/scheduled_operations.py | 6 ++---- accountant/frontend/static/js/operations.js | 2 +- accountant/frontend/static/js/scheduler.js | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/accountant/api/views/operations.py b/accountant/api/views/operations.py index fe17dd4..b89bcc3 100644 --- a/accountant/api/views/operations.py +++ b/accountant/api/views/operations.py @@ -60,7 +60,7 @@ parser.add_argument('canceled', type=bool) range_parser = reqparse.RequestParser() -range_parser.add_argument('account', type=int) +range_parser.add_argument('account_id', type=int) range_parser.add_argument('begin', type=lambda a: dateutil.parser.parse(a)) range_parser.add_argument('end', type=lambda a: dateutil.parser.parse(a)) @@ -75,7 +75,7 @@ class OperationListResource(Resource): begin=data['begin'], end=data['end'], ).filter( - Operation.account_id == data['account'] + Operation.account_id == data['account_id'] ).all(), 200 @requires_auth diff --git a/accountant/api/views/scheduled_operations.py b/accountant/api/views/scheduled_operations.py index 3c2644d..74e9fb3 100644 --- a/accountant/api/views/scheduled_operations.py +++ b/accountant/api/views/scheduled_operations.py @@ -59,7 +59,7 @@ parser.add_argument('account_id', type=int) get_parser = reqparse.RequestParser() -get_parser.add_argument('account', type=int) +get_parser.add_argument('account_id', type=int) class ScheduledOperationListResource(Resource): @@ -71,9 +71,7 @@ class ScheduledOperationListResource(Resource): """ data = get_parser.parse_args() - return ScheduledOperation.query().filter( - ScheduledOperation.account_id == data.account - ).all(), 200 + return ScheduledOperation.query().filter_by(**data).all(), 200 @requires_auth @marshal_with_field(Object(scheduled_operation_model)) diff --git a/accountant/frontend/static/js/operations.js b/accountant/frontend/static/js/operations.js index 6aca345..3efa50c 100644 --- a/accountant/frontend/static/js/operations.js +++ b/accountant/frontend/static/js/operations.js @@ -354,7 +354,7 @@ accountantApp */ $scope.load = function(begin, end) { $scope.operations = Operation.query({ - account: $routeParams.accountId, + account_id: $routeParams.accountId, begin: begin.format('YYYY-MM-DD'), end: end.format('YYYY-MM-DD') }); diff --git a/accountant/frontend/static/js/scheduler.js b/accountant/frontend/static/js/scheduler.js index 2f18cc5..a2fbe2c 100644 --- a/accountant/frontend/static/js/scheduler.js +++ b/accountant/frontend/static/js/scheduler.js @@ -48,7 +48,7 @@ accountantApp */ $scope.load = function() { $scope.operations = ScheduledOperation.query({ - account: $routeParams.accountId + account_id: $routeParams.accountId }); };