Forums

Postgres number sometimes in scientific notation

I store Decimal values in my postgres database with a django App. In django the field in the model is type : models.DecimalField(max_digits=19, decimal_places=2)

On my local server i've no problem. On pythonanywhere, sometimes the query on the DB gives : Decimal('80') and sometimes it gives Decimal('8E+1') If i refresh the webpage a few times it will switch. I've the same psycog2 version on local and pythonanywhere servers. Do you know what happens ? How could i solve that issue ? Thank you.

Is it definitely the same version of Django in both cases?

Yes it is Djando 1.9.1 in both case. I've pip freeze my virtualenv to build the requirement.txt, everything is the same. The only difference could by the postgres pythonanywhere uses.

Surely you can just format the Decimal value the way you want it in your page. Just dumping the representation to the page seems like it could produce all sorts of weird representations depending on the value.