jfinkels / flask-restless

NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.
https://flask-restless.readthedocs.io
GNU Affero General Public License v3.0
1.02k stars 301 forks source link

Sorting #653

Closed bilguun closed 7 years ago

bilguun commented 7 years ago

I have a question about sorting. I tried to use preprocessors as mentioned in the documentation but no luck.

def fetch_preprocessor(filters=None, sort=None, group_by=None, single=None,
                       **kw):
    ....

preprocessors = {  'GET_MANY': [fetch_preprocessor] }

manager.create_api(Host, 
    results_per_page=10,
    methods=['GET', 'POST', 'PUT', 'DELETE'], 
     preprocessors=preprocessors)

and called GET http://127.0.0.1:5000/api/host?sort=name but I can't access the field name atleast.

But I'm unable to access the sort argument from the request.

I'd appreciate a lot if you could help me out with this issue.