Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#20859 closed Cleanup/optimization (fixed)

Example for Model.clean doesn't call parent method

Reported by: Aymeric Augustin Owned by: jimmysong
Component: Documentation Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description warns that if one customizes the clean() method for a model, one should call the parent method to maintain default validation. shows an example which doesn't call the parent method.

I think the example should be modified to take this best practice into account.

Change History (8)

comment:1 Changed 5 years ago by Tim Graham

Component: UncategorizedDocumentation
Easy pickings: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:2 Changed 5 years ago by jimmysong

Owner: changed from nobody to jimmysong
Status: newassigned

comment:3 Changed 5 years ago by jimmysong

Has patch: set

Changed the example in the documentation. Pull request here:

comment:4 Changed 5 years ago by jimmysong

fixed the tab indent issue in pull request.

comment:5 Changed 5 years ago by Tim Graham

The warning refers to ModelForm.clean() while the example is for Model.clean() which actually does not require calling super as it does nothing. That said, I think the patch does help clarify the example, so I'll merge it minus the super call.

comment:6 Changed 5 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 94d7fed7750322e8b80402c1e731bab6d4509f2e:

Fixed #20859 - Clarified Model.clean() example.

comment:7 Changed 5 years ago by Tim Graham <timograham@…>

In ea7bef318fd42411e3db057e888367ef52fb23c3:

[1.6.x] Fixed #20859 - Clarified Model.clean() example.

Backport of 94d7fed775 from master

comment:8 Changed 5 years ago by Aymeric Augustin

Oops, sorry for the bad report :|

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