Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23865 closed Cleanup/optimization (fixed)

Document raising a `ValidationError` with a dictionary

Reported by: Alasdair Nicol Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Ticket #16986 allows you to report errors on individual fields by instantiating a ValidationError with a dictionary. However, this technique is an undocumented private API, and not mentioned in the Model.clean docs.

I started a thread on Django developers

Change History (5)

comment:1 by Alasdair Nicol, 10 years ago

Has patch: set

comment:3 by Carl Meyer, 10 years ago

Triage Stage: UnreviewedReady for checkin
Type: UncategorizedCleanup/optimization

PR seems merge-ready to me. There's been some discussion on the ML thread; I'll wait a bit for merge to see if Loic or Anssi or anyone else wants to weigh in on the PR.

comment:4 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 5b26a014a81ba0d404d46e11d2b45c01d92b97e5:

Fixed #23865 -- documented how to assign errors to a field in Model.clean()

Also added a unit test wit the simpler syntax which we have documented,
where the dictionary values are strings.

comment:5 by Tim Graham <timograham@…>, 10 years ago

In f91c6ecc223dbed05f6640af515e8b56895170ac:

[1.7.x] Fixed #23865 -- documented how to assign errors to a field in Model.clean()

Also added a unit test wit the simpler syntax which we have documented,
where the dictionary values are strings.

Backport of 5b26a014a81ba0d404d46e11d2b45c01d92b97e5 from master

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