[Django] #23286: Add the necessary return value for Form#clean (in 1.6)

4 views
Skip to first unread message

Django

unread,
Aug 13, 2014, 1:13:24 PM8/13/14
to django-...@googlegroups.com
#23286: Add the necessary return value for Form#clean (in 1.6)
--------------------------------------+--------------------
Reporter: jameydeorio | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+--------------------
The documentation for Form and field validation
(https://docs.djangoproject.com/en/1.6/ref/forms/validation/#cleaning-and-
validating-fields-that-depend-on-each-other) says nothing about returning
self.cleaned_data, without which you receive the obtuse "argument of type
'NoneType' is not iterable" along with an unhelpful stack trace, and you
wind up on StackOverflow instead of the docs to solve the issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/23286>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 13, 2014, 1:18:44 PM8/13/14
to django-...@googlegroups.com
#23286: Add the necessary return value for Form#clean (in 1.6)
-------------------------------------+-------------------------------------
Reporter: jameydeorio | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.6
Component: Documentation | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bmispelon):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Hi,

In the link you provided, the example code has these two lines at the
bottom:
{{{#!python
# Always return the full collection of cleaned data.
return cleaned_data
}}}

Is that not sufficient?

Note that if you're reading the documentation for 1.7 [1], these lines are
gone because it's not necessary to return `cleaned_data` from
`Form.clean()` anymore.
Was that the source of the confusion?

[1] https://docs.djangoproject.com/en/1.7/ref/forms/validation/#cleaning-
and-validating-fields-that-depend-on-each-other

--
Ticket URL: <https://code.djangoproject.com/ticket/23286#comment:1>

Django

unread,
Aug 13, 2014, 3:54:28 PM8/13/14
to django-...@googlegroups.com
#23286: Add the necessary return value for Form#clean (in 1.6)
-------------------------------------+-------------------------------------
Reporter: jameydeorio | Owner: nobody
Type: | Status: closed

Cleanup/optimization | Version: 1.6
Component: Documentation | Resolution:
Severity: Normal | worksforme
Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 1 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => worksforme


--
Ticket URL: <https://code.djangoproject.com/ticket/23286#comment:2>

Reply all
Reply to author
Forward
0 new messages