Opened 18 years ago
Closed 15 years ago
#6856 closed (invalid)
Better ModelForm examples
| Reported by: | James Bennett | Owned by: | James Bennett |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The examples in docs/modelforms.txt show instantiation of a form, then jump straight to saving without calling is_valid(). Several times now I've seen people assume that this means is_valid() isn't needed or present on a ModelForm, usually leading to attempts to save unvalidated data. The examples should be fleshed out a bit more to make this clear.
Change History (3)
comment:1 by , 17 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 17 years ago
comment:3 by , 15 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
The behaviour changed with model validation, and it is now correctly documented that attempting to save an invalid ModelForm will raise a ValueError.
Also see #6855 for a related issue.