Opened 15 years ago
Closed 15 years ago
#14564 closed (invalid)
case insensitive unique_together
| Reported by: | anonymous | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.2 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Should it be possible to specify a case insensitive match for unique-together fields? I have a field I'm using for abbreviations of index terms in a library catalogue, and it would be helpful to constrain new additions to be unique without regard to case.
replicate -
- Create a model with a slugfield
- Add a unique_together constraint on it
- Add items with field set to "A" and "a" without an error (although obviously sometime this is the desired behaviour)
Change History (1)
comment:1 by , 15 years ago
| Component: | Uncategorized → Database layer (models, ORM) |
|---|---|
| Resolution: | → invalid |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
The various values on the
unique_togetheroption map directly to theUNIQUEconstraint of backend databases, so the behavior ofunique_togetherdepends on this; no manual comparisons are done for the values in the columns.Your problem could be solved by always storing either lowercase or uppercase values in your
unique_together-constrained column.