From 02720a3fb65ee1dcd7de7a773a2d6770f77b6b33 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Wed, 13 Jan 2016 11:49:10 +0100 Subject: [PATCH] Rename resource_fields to operation_with_sold_model. Reorganize imports. --- accountant/api/views/operations.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/accountant/api/views/operations.py b/accountant/api/views/operations.py index 846e7dd..f8e0026 100644 --- a/accountant/api/views/operations.py +++ b/accountant/api/views/operations.py @@ -24,12 +24,12 @@ from .. import api from ..models.operations import Operation -from ..fields import Object - from .users import requires_auth +from ..fields import Object -resource_fields = { + +operation_with_sold_model = { 'id': fields.Integer(default=None), 'operation_date': fields.DateTime(dt_format='iso8601'), 'label': fields.String, @@ -65,7 +65,7 @@ range_parser.add_argument('end', type=lambda a: dateutil.parser.parse(a)) class OperationListResource(Resource): @requires_auth - @marshal_with_field(fields.List(Object(resource_fields))) + @marshal_with_field(fields.List(Object(operation_with_sold_model))) def get(self): data = range_parser.parse_args() @@ -77,7 +77,7 @@ class OperationListResource(Resource): ).all(), 200 @requires_auth - @marshal_with_field(Object(resource_fields)) + @marshal_with_field(Object(operation_model)) def post(self): data = parser.parse_args() @@ -90,7 +90,7 @@ class OperationListResource(Resource): class OperationResource(Resource): @requires_auth - @marshal_with_field(Object(resource_fields)) + @marshal_with_field(Object(operation_model)) def get(self, id): """ Get operation. @@ -103,7 +103,7 @@ class OperationResource(Resource): return operation, 200 @requires_auth - @marshal_with_field(Object(resource_fields)) + @marshal_with_field(Object(operation_model)) def post(self, id): data = parser.parse_args() @@ -124,7 +124,7 @@ class OperationResource(Resource): return operation, 200 @requires_auth - @marshal_with_field(Object(resource_fields)) + @marshal_with_field(Object(operation_model)) def delete(self, id): operation = db.session.query(Operation).get(id)