You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ce3dcc7
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Fix UniqueConstraint validation with conditional fields (#9707) (#10021)
* chore: unique constraints with distinct condition fields use unique together validator
* chore: add comments and improve tests
* test: correct assertions
* Add get_referenced_base_fields_from_q to compat and fix test indentation
- Add helper function for extracting fields from Q objects
- Move test methods inside TestUniquenessTogetherValidation class
* Apply Copilot suggestions: fix heading hierarchy and use Django's Q.referenced_base_fields
* Fix all remaining issues: empty constraint.fields, preserve constraint for custom messages, recheck condition field changes
- Add check for empty constraint.fields in get_unique_together_constraints
- Preserve original constraint object for custom violation messages/codes
- Extend UniqueTogetherValidator to recheck when condition fields change
- Add test for condition field change triggering revalidation
* Refactor uniqueness validation test case
* Fix nulls_distinct guard and update docstring
* Address review feedback: remove compat helper, fix partial update regression, cleanup style
---------
Co-authored-by: nefrob <nefrob.skyguy@gmail.com>
Co-authored-by: Asif Saif Uddin {"Auvi":"অভি"} <auvipy@gmail.com>
0 commit comments