Changes between Initial Version and Version 1 of Ticket #31420, comment 4


Ignore:
Timestamp:
Apr 3, 2020, 12:39:45 AM (5 years ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31420, comment 4

    initial v1  
    55This happens to be `Col.field` https://github.com/django/django/blob/89032876f427a77ab4de26493190280377567d1c/django/db/models/sql/query.py#L235-L236
    66
    7 Now `Col.field` is actually `Expression.field` which is actually an alias for `.output_field` (not sure why) but in order to allow the special related field lookup conversion of `SimpleLazyObject` to model instance (e.g. needed for stuff like `.filter(user=request.user)` where `request.user` is a `SimpleLazyObject`) it's the `Col.target` that should be used as `output_field`.
     7Now `Col.field` is actually `Expression.field` which is actually an alias for `.output_field` (not sure why) but in order to allow the special related field lookup conversion of `SimpleLazyObject` to model instance (e.g. needed for stuff like `.filter(user=request.user)` where `request.user` is a `SimpleLazyObject`) it's the `Col.target` that should be used as `output_field` and not `Col.field`.
    88
    99{{{#!diff
     
    2222}}}
    2323
     24The suite seems to agree from my local testing.
Back to Top