Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#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)

0001-Fixed-14102-Changed-_get_unique_checks-to-respect-th.patch (3.8 KB ) - added by Travis Cline 14 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Jacob, 14 years ago

milestone: 1.3
Triage Stage: UnreviewedReady for checkin

comment:2 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(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.

comment:3 by Russell Keith-Magee, 14 years ago

(In [13599]) [1.2.X] 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.

Backport of r13598 from trunk.

comment:4 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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