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|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
_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.
Change History (5)
Changed 6 years ago by