#9319 closed (fixed)
error when a field is used in twice in unique_together
Reported by: | tangc | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.0 |
Severity: | Keywords: | forms/models.py | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
The forms/models.py has the following code
at line 287 -- 289 for "Django version 1.0-post-release-SVN-SVN-unknown"
# Remove the data from the cleaned_data dict since it was invalid
for field_name in unique_check:
del self.cleaned_data[field_name]
The above code should be commented out for it leads to error or exception for the case of model
meta:
unique_together = (("QUESTION_FK", "PROTOCOL_FK"),("EMAIL", "PROTOCOL_FK"), )
This case need to check unique "PROTOCOL_FK" twice
Attachments (2)
Change History (7)
by , 16 years ago
comment:1 by , 16 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Summary: | forms/models.py bugs → error when a field is used in twice in unique_together |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 years ago
Since we might (hopefully) be not completely removing cleaned_data when there's a validation failure in the future, it's worthwhile being neat and tidy here and removing the data that is problematic.
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
It does seem that deleting from
cleaned_data
is quite redundant sincefull_clean
removes the whole dict anyway.ctao: thanks for the report however a try to use a descriptive summary and use a diff rather than attaching the full edited file (use
svn diff > 9319.diff
)