Re: form.is_valid() NOT triggering model validation?

2011-09-29 Thread momo2k
Well, with the new knowledge about the debugger I found the place
where BaseModelForm calls all three form-validation methods in forms/
models.py:306:_post_form

Sorry.

On Sep 29, 9:26 pm, momo2k  wrote:
> That explains my thoughts that the debugger is "disturbing" the
> correct execution of the code, but this discussion does *not* (!)
> answer my question where the *model* of a *ModelForm* gets full_clean-
> ed - and why it doesn't do so in my case.
>
> On Sep 29, 8:48 pm, Shawn Milochik  wrote:
>
>
>
>
>
>
>
> > This exact thing was just discussed on this list.
>
> >https://groups.google.com/d/topic/django-users/R2HUGqZ1BAQ/discussion

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.is_valid() NOT triggering model validation?

2011-09-29 Thread momo2k
That explains my thoughts that the debugger is "disturbing" the
correct execution of the code, but this discussion does *not* (!)
answer my question where the *model* of a *ModelForm* gets full_clean-
ed - and why it doesn't do so in my case.

On Sep 29, 8:48 pm, Shawn Milochik  wrote:
> This exact thing was just discussed on this list.
>
> https://groups.google.com/d/topic/django-users/R2HUGqZ1BAQ/discussion

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.is_valid() NOT triggering model validation?

2011-09-29 Thread Shawn Milochik
This exact thing was just discussed on this list.

https://groups.google.com/d/topic/django-users/R2HUGqZ1BAQ/discussion

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



form.is_valid() NOT triggering model validation?

2011-09-29 Thread momo2k
Hello,

after hours of examinating and debugging the Django source code I
decided to post my problem here.

I'm using Django 1.3.1 and its docs say:


The is_valid() method and errors
Changed in Django 1.2: Please, see the release notes

The first time you call is_valid() or access the errors attribute of a
ModelForm has always triggered form validation, but as of Django 1.2,
it will also trigger model validation. This has the side-effect of
cleaning the model you pass to the ModelForm constructor. For
instance, calling is_valid() on your form will convert any date fields
on your model to actual date objects.


I'm using a FormView with a ModelForm. No matter if I add an instance
to the forms kwargs, the model.full_clean method is *not* called by
form.is_valid(). This is working fine later by

def form_valid(.

self.obj= form.save(commit=False)
self.obj.full_clean()

I thought my python skills would be OK after one and a half year of
django programming, but I neither get why the _errors attribute of the
BaseForm (forms.Form:109) is always ErrorDict, even directly after
assigning it to None (forms.Form:84) according to the pydev-debugger,
and therefore form.clean() is never called - nor where the
model.full_clean() method is called at all. The implementation of
ModelForm/BaseModelForm is not that confusing.
I would be lucky if someone could explain to me why model validation
is not triggered with my ModelForm and where to find the piece of code
that does it.

If you need more information, just ask, please.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.