Closed m3talstorm closed 7 years ago
Have you looked at predefined database filters (http://python-eve.org/config.html#filter) ?
I will close this as your question is unfortunately quite old already and I doubt you still wait for an answer - sorry for that! Feel free to reopen it at any time if needed :).
I'm using Python EVE, EVE-SQLALchemy, Flask, Flask-SQLALchemy, SQLALchemy and a Postgres database.
I have my API endpoints all setup and they are working fine out the box.
Now i'm trying to filter the items returned by the _somemodel resource so that it only returns items (GET) that belong to a certain user (the user doing the API request) or have a certain name (prefix). The SQlAlcehmy code to perform this is below:
I've looked at pre and post request hooks, User-Restricted Resource Access and everything else I could find, but nowhere seems to describe how to apply custom filters to (all) GET requests of a certain endpoint/resource.
Kind of like the URL filter functionality, but always on and filtering at the database level, not the serialization/response level.