Opened 9 years ago
Closed 9 years ago
#26259 closed New feature (wontfix)
Form.cleaned_data should call is_valid() if necessary
Reported by: | Thomas Güttler | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
We stumbled over this code:
form.is_valid() if form.cleaned_data.get('cancel'): ...
We did not understand why form.is_valid()
is necessary.
It seems that form.cleaned_data
is not a property, you need to call is_valid()
first.
It would be nice if Form.cleaned_data
is be a property, this way the following code would just work:
if form.cleaned_data.get('cancel'): ...
Change History (1)
comment:1 by , 9 years ago
Component: | Uncategorized → Forms |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Summary: | Form.cleaned_data should be a property → Form.cleaned_data should call is_valid() if necessary |
Type: | Uncategorized → New feature |
Note:
See TracTickets
for help on using tickets.
I don't think an implicit call to
is_valid()
is a good idea. Most of the time, you do want different handling for valid and invalid forms. Of course, you could write your own subclass ofForm
which has the behavior you desire.Feel free to raise the idea on the DevelopersMailingList for other opinions.