Opened 15 years ago

Closed 15 years ago

#12520 closed (fixed)

django.contrib.auth.forms.UserCreationForm.clean doesn't return cleaned_data dictionary

Reported by: Gregor Müllegger Owned by: nobody
Component: Forms Version: 1.2-alpha
Severity: Keywords:
Cc: gregor@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The clean() method of django.contrib.auth.forms.UserCreationForm looks like this (trunk version)

    def clean(self):
        # Fill the password field so model validation won't complain about it
        # being blank. We'll set it with the real value below.
        self.instance.password = UNUSABLE_PASSWORD
        super(UserCreationForm, self).clean()

It is missing a return statement that returns the cleaned_data dictionary. Because of that the form.cleaned_data attribute will be None after validating the form.

I think this behaviour is not intended -- athorwise there would be a comment.

Change History (4)

comment:1 by Gregor Müllegger, 15 years ago

Cc: gregor@… added

comment:2 by jasongreen, 15 years ago

I have the same problem..

comment:3 by jonlesser, 15 years ago

Version: SVN1.2-alpha

I am also having this problem in r12205. The form's save() function returns the new user, so I am able to access "cleaned" data from there, but it seems cleaner to have access to cleaned data.

comment:4 by jkocherhans, 15 years ago

Resolution: fixed
Status: newclosed

(In [12206]) Fixed #12512. Changed ModelForm to stop performing model validation on fields that are not part of the form. Thanks, Honza Kral and Ivan Sagalaev.
This reverts some admin and test changes from [12098] and also fixes #12507, #12520, #12552 and #12553.

Note: See TracTickets for help on using tickets.
Back to Top