Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#12643 closed (fixed)

Should mention to call parent clean method for modelForm in custom validation chapter

Reported by: fgaudin Owned by: ptone
Component: Documentation Version: 1.1
Severity: Keywords: ModelForm, validation, clean
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I and some collegues always refer to http://docs.djangoproject.com/en/1.1/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other to check how to do custom validation, I've been looking for a while before finding that I need to call the parent clean method for modelForm (to avoid postgres to raise the unique constraint error).

I found later that it was written in ModelForm documentation. Just a warning with a link to this chapter would be great.

Attachments (1)

12833.diff (840 bytes) - added by ptone 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by russellm

  • milestone set to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 5 years ago by ptone

comment:2 Changed 5 years ago by ptone

  • Has patch set
  • Owner changed from nobody to ptone

I inserted the note and link where it seemed most appropriate in the introduction to the clean method - I couldn't figure out if there is a way to link to a #section, and couldn't find any example of such a ref after a quick look around the docs.

comment:3 Changed 5 years ago by russellm

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [13163]) Fixed #12643 -- Added link to the ModelForm documentation clarifying the special requirements of a clean() method on a modelform. Thanks to fgaudin for the report, and ptone for the patch.

comment:5 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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