@ -151,6 +151,8 @@ class CommentsResource(flask_restful.Resource):
if args['sort_order'] == 'random':
q = q.order_by(sqlalchemy.func.random())
elif args['sort_by']:
col = getattr(Association, args['sort_by'], None)
if not col:
col = getattr(Comment, args['sort_by'], None)
if col:
if args['sort_order']: