#22288: F() expression not compatible with __range field look up -------------------------------------+------------------------------------- Reporter: liushaohua86@… | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: master (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 1 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+------------------------------------- Changes (by akaariai):
* needs_better_patch: 0 => 1 Comment: I checked the patch. It seems we need changes to too many places just to support `something__range=(F('foo'), F('bar'))`. The main issue is that we have many rounds of value preparation. The main issue here is that we just don't handle the case here value is an iterable correctly for value preparation. While the above mentioned commit touches the area around range lookups, we should likely fix all the lookups to lists of F() objects properly. Even if the only other example in core is `somefield__in=[F()]`. It might be better to wait for #14030 before applying this one. In addition the tests of the above patch aren't correct, the code checks generated SQL, but that SQL differs between backends (quote character is not always `"`, and some backends IIRC use upper case table names). Sorry for delay in commenting this issue. -- Ticket URL: <https://code.djangoproject.com/ticket/22288#comment:4> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/080.ca9f34556aee074ab5ef64e8c5f33fc8%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.