Re: DecimalField Problem

2014-01-14 Thread Tom Evans
On Tue, Jan 14, 2014 at 7:23 AM, Eric Rouleau wrote: > The problem seems to be in the postgres backend or Psycopg 2.5.2 adapter... > I have the same problem and the data in postgres is 0. but when > fetched by django it comes up as Decimal("0E-8") (with shell access not only > admin), if I

Re: DecimalField Problem

2014-01-14 Thread Eric Rouleau
The problem seems to be in the postgres backend or Psycopg 2.5.2 adapter... I have the same problem and the data in postgres is 0. but when fetched by django it comes up as Decimal("0E-8") (with shell access not only admin), if I switch to sqlite3 backend then it works perfectly On Thur

Re: DecimalField Problem

2014-01-09 Thread Timothy W. Cook
On Wed, Jan 8, 2014 at 10:42 PM, Dennis Lee Bieber wrote: > If Django's "DecimalField" is NOT use Python's Decimal type, I'd be > concerned... Python's Decimal is NOT a "float". > > However, the conversion of a Decimal to/from PostgreSQL might > result in > a floating point value

Re: DecimalField Problem

2014-01-08 Thread Mike Dewhirst
On Thursday, January 9, 2014 7:37:43 AM UTC+11, Timothy W. Cook wrote: > > > On Wed, Jan 8, 2014 at 6:07 PM, Erik Cederstrand > > > wrote: > >> Den 08/01/2014 kl. 17.56 skrev Daniel Roseman >> >> >: >> > > > >> But to post the solution to the issue, just for completeness. >> > > Yes, Djan

Re: DecimalField Problem

2014-01-08 Thread Timothy W. Cook
On Wed, Jan 8, 2014 at 6:07 PM, Erik Cederstrand wrote: > Den 08/01/2014 kl. 17.56 skrev Daniel Roseman : > > > > Greatly embarrassed, and thanks for clarifying. Will be more careful when > answering next time :-) > > Erik > > Well, Erik. I appreciate you answering even if it wasn't 100% accurate

Re: DecimalField Problem

2014-01-08 Thread Erik Cederstrand
Den 08/01/2014 kl. 17.56 skrev Daniel Roseman : > > No, no, no. None of this is true. > > Decimals are not a differently-formatted version of floats. Decimals are not > a built-in datatype in Python, it's true, but they are provided in the > standard library in (not surprisingly) the `decimal`

Re: DecimalField Problem

2014-01-08 Thread Timothy W. Cook
On Wed, Jan 8, 2014 at 2:56 PM, Daniel Roseman wrote: > > No, no, no. None of this is true. > > Decimals are not a differently-formatted version of floats. Decimals are > not a built-in datatype in Python, it's true, but they are provided in the > standard library in (not surprisingly) the `decima

Re: DecimalField Problem

2014-01-08 Thread Daniel Roseman
On Wednesday, 8 January 2014 16:47:52 UTC, Erik Cederstrand wrote: > > Den 08/01/2014 kl. 17.11 skrev Timothy W. Cook >: > > > > But one would think that if Django calls it a decimal field, it would > convert the float to decimal. > > I suppose I'll do that before writing it out to the file (a

Re: DecimalField Problem

2014-01-08 Thread Erik Cederstrand
Den 08/01/2014 kl. 17.11 skrev Timothy W. Cook : > But one would think that if Django calls it a decimal field, it would convert > the float to decimal. > I suppose I'll do that before writing it out to the file (an XML schema) so > it really isn't a big deal, just surprising. Ah, the “decimal

Re: DecimalField Problem

2014-01-08 Thread Timothy W. Cook
On Wed, Jan 8, 2014 at 1:44 PM, Erik Cederstrand wrote: > Den 08/01/2014 kl. 16.18 skrev Timothy W. Cook : > > > > So, why doesn't it just store a zero? > > Underneath a DecimalField there is a Python float type, and some > equivalent float type in your database. Float values are an approximation

Re: DecimalField Problem

2014-01-08 Thread Erik Cederstrand
Den 08/01/2014 kl. 16.18 skrev Timothy W. Cook : > I have several decimal fields defined in the model like this: > > min_inclusive = models.DecimalField(_('minimum inclusive'), max_digits=19, > decimal_places=10, help_text=_("Enter the minimum (inclusive) value for this > concept."), null=True,

DecimalField Problem

2014-01-08 Thread Timothy W. Cook
I have several decimal fields defined in the model like this: min_inclusive = models.DecimalField(_('minimum inclusive'), max_digits=19, decimal_places=10, help_text=_("Enter the minimum (inclusive) value for this concept."), null=True, blank=True) Via the admin interface when I enter a 0 (zero)