'Virtual attributes in query

I have "rating" attribute in my model:

Screenshot of code

And to get rating of one item I do:

Screenshot of code

How to do like Quest.query().where(...).rating()?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source