Hi,

Have you called is_valid() on the form before that ?

Regards,
Xavier Ordoquy,
Linovia.

Le 28 mars 2012 à 15:57, Marcin a écrit :

> Consider the following stack trace (all relevant code is shown in the stack 
> trace):
> 
> In [3]: f.clean()
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call last)
> C:\Users\Marcin\Documents\oneclickcos\lib\site-packages\django\core\management\commands\shell.pyc
>  in <module>()
> ----> 1 f.clean()
> 
> C:\Users\Marcin\Documents\oneclickcos\oneclickcos\mainapp\incorporate_helpers.pyc
>  in clean(self)
>     569         This checks the relations between fields, ensures consistent 
> state, and exports bits about the state of the form that can be used in 
> subsequent
> validations
>     570         """
> --> 571         cleaned_data = super(IncorporateForm, self).clean()
>     572         #logger.debug('IncorporationForm.cleaned_data: ' + 
> str(cleaned_data))
> 
>     573         try:
> 
> C:\Users\Marcin\Documents\oneclickcos\oneclickcos\mainapp\incorporate_helpers.pyc
>  in clean(self)
>     402
>     403     def clean(self):
> --> 404         cleaned_data = super(CreateForm, self).clean()
>     405         # trying to use an empty pk can result in a ValueError. 
> Easier to expunge.
> 
>     406         if cleaned_data.get('pk', None) == '': del cleaned_data['pk']
> 
> C:\Users\Marcin\Documents\oneclickcos\lib\site-packages\django\forms\forms.pyc
>  in clean(self)
>     315         association with the field named '__all__'.
>     316         """
> --> 317         return self.cleaned_data
>     318
>     319     def has_changed(self):
> 
> AttributeError: 'IncorporateForm' object has no attribute 'cleaned_data'
> 
> As you can see, my code conforms to the examples at 
> https://docs.djangoproject.com/en/1.4/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other.
> 
> However, the error comes from BaseForm's clean method, which expects a 
> cleaned_data property or attribute to exist. What gives? Is this a bug in 
> django?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/_yqLTmCFK4MJ.
> 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.

-- 
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.

Reply via email to