That's great the way you found the workaround :D
We can also try writing raw sql queries to use sql functions
https://docs.djangoproject.com/en/2.2/topics/db/sql/#executing-custom-sql-directly
But that has some security issues since we have to pass a search parameter
into it.
On Mon, 21 Jun 2021
Thanks for the quick response Lalit,
Django "Round" rounds to the nearest integer whereas SQLite "round" allows
you to pass in a second parameter to to round "rounded to Y digits to the
right of the decimal point" (https://sqlite.org/lang_corefunc.html#round).
That said, since Django "Round" does
this can help
https://docs.djangoproject.com/en/2.2/ref/models/database-functions/#round
On Fri, 18 Jun 2021 at 22:43, Wai Yeung wrote:
> Hello,
>
> To be able to get a REAL value from a SQLite database rounded to 2 decimal
> places, I had to use the following RAW SQL query:
>
> SELECT
>
Hello,
To be able to get a REAL value from a SQLite database rounded to 2 decimal
places, I had to use the following RAW SQL query:
SELECT
printf("%.2f", round(orig_total,2)),
FROM final_billing_tbl
I would like to be able to duplicate the functionality of the in ORM to
create a q
4 matches
Mail list logo