#34871: Validation of UniqueConstraint with Case() crashes.
-------------------------------------+-------------------------------------
Reporter: Andrew Roberts | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
Making `Q` more `Expression`-like is definitely the way to approach this
problem so you're right. The way to make it more like so proposed above
would be to have it store `Expression`-like objects (`UnresolvedLookup`
instances) instead of `tuple[str, Any]` it its children AKA ''source
expressions''.
In other words, having `Q(name__lower__exact="david")` turned into
`Q(UnresolvedLookup(F("name"), "lower__exact", "david"))` internally and
having `UnresolvedLookup.resolve_expressions` do what `Query.build_filter`
does when dealing with `("name__lower__exact", "david")` would make `Q`
more `Expression`-like and allow methods such as `replace_expressions`.
--
Ticket URL: <https://code.djangoproject.com/ticket/34871#comment:12>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018dd68f3c3d-5ed15062-8b96-45eb-a873-c2e68aeb7f75-000000%40eu-central-1.amazonses.com.