def get(self, user_id=0, username=None): user = None if username: user = User.get_by_username(username) elif user_id: user = User.get_by_id(user_id) if not user: abort(404) return user
def get(self, user_id=None, username=None): user = None if username is not None: user = User.get_by_username(username) else: user = User.get_by_id(user_id) if not user: abort(404) return user
def get(self, user_id=0, username=''): # Find user that task goes with if user_id: user = User.get_by_id(user_id) elif username: user = User.get_by_username(username) if not user: abort(404) # Get the user's tasks tasks = Task.query.filter_by(user_id=user.id) args = task_collection_parser.parse_args() # fancy url argument query filtering! if args['complete'] is not None: tasks.filter_by(complete=args['complete']) return tasks
def get(self, user_id=None, username=None): # Find user that task goes with user = None if user_id: user = User.get_by_id(user_id) else: user = User.get_by_username(username) if not user: abort(404) # Get the user's tasks tasks = Task.query.filter_by(user_id=user.id) args = task_collection_parser.parse_args() # fancy url argument query filtering! if args['complete'] is not None: tasks.filter_by(complete=args['complete']) return tasks
def post(self): user = User.create(**user_parser.parse_args()) return user, 201