Django: How should I store a money value?
You store it as a DecimalField and manually add the decimals if you need to, as Valya said, using basic formatting techniques.
You can even add a Model Method to you product or transaction model that will spit out the DecimalField as an appropriately formatted string.
I'm running into a paradigm problem here. I don't know whether I should store money as a Decimal(), or if I should store it as a string and convert it to a decimal myself. My reasoning is this:
PayPal requires 2 decimal places, so if I have a product that is 49 dollars even, PayPal wants to see 49.00 come across the wire. Django's DecimalField() doesn't set a decimal amount. It only stores a maximum decimal places amount. So, if you have 49 in there, and you have the field set to 2 decimal places, it'll still store it as 49. I know that Django is basically type casting when it deserializes back from the database into a Decimal (since Databases don't have decimal fields), so I'm not completely concerned with the speed issues as much as I am with the design issues of this problem. I want to do what's best for extensibility.
Or, better yet, does anyone know how to configure a django DecimalField() to always format with the TWO_PLACES formatting style.