I have some fields that represent recommendations (forex). I modeled them as numeric(8,4) (postgresql).
The problem is that the django admin automatically adds trailing 0's. I don't want that because in order to calculate profit/loss, I need to subtract the numbers (as integers, I eliminate the decimal points) and multiply by 10 (the leverage). I want the admin to save the number exactly as input. Postgres does not add trailing 0's, but Django does. Here are some samples and why the trailing 0's are wrong. 76.6000 - 77.3800 -- Converted should be 7660 - 7738 The correct answer should be -78, but eliminating the decimal creates this 766000 - 773800 or -7800, doing the math as floats is wrong as well: -(.78) =-7.8, not -78, so this actually works if I remove the decimal and then * 10. (loss should be 780) 1.3040 - 1.3090 -- Converted should be 13040 - 13090 the correct answer should be -50. Eliminating the decimals creates the correct answer in this case, but doing the math as float and then converting gives: .005 (I then remove the string leaving 5, not 50) (loss should be 500) Basically I need to know if there is a way to have django not add trailing 0's, then I can convert correctly. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.