Fixed #21942 -- Added missing documentation of Form.clean() to API, added new description and crosslinks #2334

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

Fixed #21942 -- Added missing documentation of Form.clean() to API, added new description and crosslinks

@timgraham timgraham commented on the diff Feb 20, 2014

docs/ref/forms/api.txt
@@ -128,20 +162,6 @@ instances.
{'sender': [ValidationError(['Enter a valid email address.'])],
'subject': [ValidationError(['This field is required.'])]}
-Use this method anytime you need to identify an error by its ``code``. This
@timgraham

timgraham Feb 20, 2014

Owner

It looks like you've made a mistake rebasing your changes or something as there are unrelated changes in the PR such as removing this content.

@timgraham timgraham commented on the diff Feb 20, 2014

docs/ref/forms/validation.txt
Cleaning and validating fields that depend on each other
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. method:: django.forms.Form.clean()
+.. :noindex:method:: django.forms.Form.clean
@timgraham

timgraham Feb 20, 2014

Owner

You can remove this line.

@timgraham timgraham commented on the diff Feb 20, 2014

docs/ref/forms/api.txt
@@ -70,6 +70,40 @@ should consider its data immutable, whether it has data or not.
Using forms to validate data
----------------------------
+.. method:: Form.clean()
+
+Use ``Form.clean()`` when you must validate fields that are interdependent.
@timgraham

timgraham Feb 20, 2014

Owner

Form.clean() is different from the other methods listed here in that it's just a hook that you have to implement yourself. I suggest emphasizing that with something like the following: "Implement a clean() method on your Form when you must add custom validation for fields that are interdependent. See :ref:cleaning-and-validating-fields-that-depend-on-each-other for example usage."

I think it'll be best to leave it that, rather than repeat examples that come from the other section.

Owner

timgraham commented Apr 7, 2014

Please send a new PR if you can update this, thanks.

timgraham closed this Apr 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment