On Tue, 2007-05-01 at 16:28 -0400, Andy Dustman wrote:
> On 5/1/07, Chris Brand <[EMAIL PROTECTED]> wrote:
> >
> > I've got a model that includes FloatFields as well as IntegerFields and
> > CharFields.
> > When I access the CharFields, I get strings. When I access the
> > IntegerFields, I get integers, but when I want to use the Floatfields, I
> > always have to add float() to convert the string to an actual float. Not
> > that big a deal, but I always forget it first time around, and it just
> > doesn't feel right.
> >
> > Here's a brief test :
> > >>> c = Camp.objects.get(pk=1)
> > >>> c.min_age
> > '17.0'
> > >>> a = c.min_age
> > >>> type(a)
> > <type 'str'>
> >
> > And here's the corresponding field definition :
> >     min_age = models.FloatField("Minimum age", max_digits=3,
> > decimal_places=1, default=0, validator_list=[age_validator])
> >
> > Why is this ?
> >
> > I'm using 0.96 with a MySQL backend.
> 
> What version of Python are you using? I *think* FloatFields are
> returned as Python Decimal objects, which don't exist before
> Python-2.4, which means you would then get a string from MySQLdb. We
> might need a fix for Django on Python-2.3 to work around this.

I'm going to work on that problem (putting in decimal support) this week
sometime. Maybe today or tomorrow. It's starting to annoy me, seeing all
the decimal-reated tickets in Trac, so after I knock off all the email
ones (today), I want to fix up the decimal problem, in between other
things.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to