On 05/12/2011 08:04 PM, Russell Keith-Magee wrote:

I suspect the answer will lie somewhere between get_prep_value() and
to_python() on DecimalField, but you'll need to do some code path
tracing to confirm. Looking at the code, I'm a little surprised that
it doesn't work as is...

Yours,
Russ Magee %-)

Russell,

Thanks for the comments. I did dig into the code after my last e-mail and I'm starting to understand how it works. It may be where you say, and I see why it's definitely not a case of overriding the __init__ function.

The reason it is so liberal in accepting values at the moment is that get_default function, which turns the default value into unicode before returning it. I have a patch half-done (or so). Frustratingly, when I try checking to see if f.has_default(), it returns True even if it's a NOT_PROVIDED object. If I import NOT_PROVIDED into the validation and check if "f.default is NOT PROVIDED" then it works. I'll report back when I'm further along.

Shawn


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

Reply via email to