--
Ticket URL: <https://code.djangoproject.com/ticket/27414>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
New description:
Assuming that Relationship consists of `from_person` and `to_person`
ForeignKey fields (which point to User), here's an simple example of
showing the actual problem:
bug, as I haven't found any explanation for this behavior. In my case in
aliased fields I would need objects to be returned, not only IDs of them,
therefore I don't know how to solve this.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27414#comment:1>
* component: Database layer (models, ORM) => Documentation
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
I'm not sure if that can be changed easily, for one, it will be backwards-
incompatible for anyone relying on the current behavior. Feel free to get
other opinions on the DevelopersMailingList. Qualifying as a documentation
change for now.
It would be nice to describe your use case in some more detail to decide
whether or not Django must provide a way for aliasing to return instances.
--
Ticket URL: <https://code.djangoproject.com/ticket/27414#comment:2>
Comment (by Josh Smeaton):
(I lost the original comment I wrote here so here's a condensed version).
Using a ForeignKey as the output_field is an interesting idea that I
hadn't considered, and would solve any backward compatibility issues. I
don't know what the difficulty would be, but F fields already have access
to the query to add necessary joins. I doubt foreign key fields are added
to joins right yet, but __underscore relationships do add joins to the
query. The next hard thing would be reconstructing the object.
All of this sounds doable though.
--
Ticket URL: <https://code.djangoproject.com/ticket/27414#comment:3>
* owner: nobody => Jop Reyntjes
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/27414#comment:4>
* has_patch: 0 => 1
* version: 1.10 => master
Comment:
[https://github.com/django/django/pull/7512 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/27414#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f8fab6f90233c7114d642dfe01a4e6d4cb14ee7d" f8fab6f9]:
{{{
#!CommitTicketReference repository=""
revision="f8fab6f90233c7114d642dfe01a4e6d4cb14ee7d"
Fixed #27414 -- Doc'd that F() expressions on relations return pk values.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27414#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"89d960121d97a3c2fc8bc768f75bc24f43838c6c" 89d9601]:
{{{
#!CommitTicketReference repository=""
revision="89d960121d97a3c2fc8bc768f75bc24f43838c6c"
[1.10.x] Fixed #27414 -- Doc'd that F() expressions on relations return pk
values.
Backport of f8fab6f90233c7114d642dfe01a4e6d4cb14ee7d from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27414#comment:7>