#31714: ResolvedOuterRef object has no get_lookup -------------------------------------+------------------------------------- Reporter: BorisZZZ | Owner: (none) Type: | Status: new Cleanup/optimization | Component: Database layer | Version: 3.0 (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):
FWIW I [https://forum.djangoproject.com/t/error-when-annotating-distance- between-2-points-inside-a-subquery-geodjango/30879 stumbled upon another user running into the same problem] but for `_output_field_or_none`. I think that an appropriate solution here could be to 1. Allow an `output_field` to be specified to `OuterRef` and percolate to `ResolvedOuterRef`. It's a common pattern for `Expression`-like to accept this kind of parameter. 2. At the time `ResolvedOuterRef` performs its final resolution in the outer query error out if there is a mismatch of `output_field` (type only should be enough) between what was explicitly specified and the resolved expression one. While the `ExpressionWrapper` solution works I think [https://forum.djangoproject.com/t/error-when-annotating-distance- between-2-points-inside-a-subquery-geodjango/30879/4 it's a big leap] for users to figure out they should be using it when they encounter a seemingly random `AttributeError`. -- Ticket URL: <https://code.djangoproject.com/ticket/31714#comment:7> 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018f4e4595ec-e9a97366-3e36-47a8-b902-3e8fabc7e01b-000000%40eu-central-1.amazonses.com.