#14102 closed (fixed)
Model._get_unique_checks can return fields that are in the exclude list
| Reported by: | Travis Cline | Owned by: | nobody | 
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.2 | 
| Severity: | 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
_get_unique_checks will return fields listed in the exclude list if they are on the other end of a unique_for_*
This in practice means that if you validate a ModelForm without the depended on field for a unique_for_* constraint _perform_unique_checks will raise an exception when it attempts to access attributes of getattr(self, unique_for) (since it's None).
Attached is a patch that prevents fields from being returned as date checks if they're in the excludes list and augments two appropriate tests.
Attachments (1)
Change History (5)
by , 15 years ago
| Attachment: | 0001-Fixed-14102-Changed-_get_unique_checks-to-respect-th.patch added | 
|---|
comment:1 by , 15 years ago
| milestone: | → 1.3 | 
|---|---|
| Triage Stage: | Unreviewed → Ready for checkin | 
comment:2 by , 15 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
comment:3 by , 15 years ago
  Note:
 See   TracTickets
 for help on using tickets.
    
(In [13598]) Fixed #14102 -- Ensure that fields that have been excluded from a form aren't included in the unique_for_* checks, either. Thanks to Travis Cline for the report and fix.