Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#14102 closed (fixed)

Model._get_unique_checks can return fields that are in the exclude list

Reported by: tclineks 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: UI/UX:

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 tclineks 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by jacob

  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 Changed 5 years ago by russellm

(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 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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