-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lookup function in Q expression #7
Comments
Yes, Round can be used as a function, or as a lookup. But to use it as a lookup, it has to registered as a transform with In [1]: from model_values import F
In [2]: round(F.sales)
Out[2]: Round(F(sales))
In [3]: F.sales.round > 100.0
Out[3]: <Q: (AND: ('sales__round__gt', 100.0))> |
can we add this to documentation? |
Added in 3115244. |
thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm new to django-model-values and I really think it will be worth the time to learn it well. I especially like the pandas-like notation. Right now I'm trying to understand understand Lookup functions.
Consider the following Q expression:
Q(sales__gt = 100.00)
Now I would like to use round to round the sales value (which is a float) to the nearest penny. Is that even possible? I've looked at the examples in test_all.py, but I'm still in a fog.
Thanks.
The text was updated successfully, but these errors were encountered: