F() expression in the math.atan function. "a float is required"

17 views
Skip to first unread message

Brian Risselada

unread,
Jun 17, 2017, 9:02:35 AM6/17/17
to Django users
I am trying to run a query that uses an expression wrapper. Within this wrapper I'm calling the math.atan function, and within that function I'm calling an F() expression. The F() expression is getting data with a DecimalField datatype. I'm getting an error stating that "a float is required". The F() expression in the math.atan function is the problem because when I've replaced the F() expression with just a number it works fine. Does anyone know how to make the F() expression work within the math.atan function?

Thank you

Brian Risselada

unread,
Jun 17, 2017, 10:37:19 AM6/17/17
to Django users
On further investigation and thoughts, I think I may need to replace math.atan with some kind of django query expression function that will allow the arc-tangent to be calculated within a query expression. Does one already exist?

Brian Risselada

unread,
Jun 17, 2017, 10:58:15 AM6/17/17
to Django users
Nevermind, I figured it out. Instead of math.arctan, I used Func() with function='ATAN'.
Reply all
Reply to author
Forward
0 new messages