> -----Original Message-----
> From: wiswaud [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 28, 2007 08:44 PM
> To: 'Django users'
> Subject: Re: Model.validate() bug???
> 
> 
> Hi!
> 
> On Nov 28, 3:22 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> > On 11/28/07, wiswaud <[EMAIL PROTECTED]> wrote:
> >
> > > So i just create a new object, like f=Foo(), and fill in the fields
> > > based on which ones were present in the input data.
> >
> > > Then i call f.validate().
> >
> > Model validation is a work in progress, and is nowhere near being
> > usable (something that a quick search of the archives would turn up).
> 
> i apologize; i had searched quickly but missed those posts...
> 
> > When it's ready for use, it will be documented.
> 
> perhaps i can help?
> it would certainly be quite useful to me.
> 
> From the looks of it, it seems that the validate() method of some
> field types aren't implemented. If everyone has better things to do,
> maybe i can try to send a patch to nudge it a little further along.
> 

(now strongly in "thread should be on django-devel" territory)

I changed validate_full() to this:
       if not self.blank and (field_data is None or field_data == ''):
            return [_('This field is required.')]

and IntegerField was now properly validated. However IntegerFields now error 
when they are set to '0' instead of 0, so perhaps a to_python() method similar 
to AutoFields should be added to IntegerField.

Also, this change breaks the regression tests for the serializers. Seems there 
is a data item where an IntegerData is set to None. Why use None and not 0?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to