{{{
>>> Entry.objects.values('blog')
[{'blog': 1}, ...]
}}}
But I have a case where I need to fetch a property from a related mode so
I'm doing this -
{{{
>>> Boundary.objects.values('id', 'school__liblangagg__class_name')
[{'school__liblangagg__class_name': 6, 'id': 8999},
{'school__liblangagg__class_name': 5, 'id': 8954},
{'school__liblangagg__class_name': 3, 'id': 9000},
{'school__liblangagg__class_name': 2, 'id': 8942},]
}}}
It'd be really convenient if I could alias the related property. Something
like this -
{{{
>>> Boundary.objects.values('id', ('class_name',
'school__liblangagg__class_name'))
[{'class_name': 6, 'id': 8999}, ... ]
}}}
So in place of the string representing the related property, we could have
a tuple (alias, related_string). The output looks a bit ugly to pass this
on to somewhere and it's a bit of work to iterate over all of them and
replace the key.
Does it seem like a feature worth considering?
--
Ticket URL: <https://code.djangoproject.com/ticket/24084>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_docs: => 0
Comment:
> Does it seem like a feature worth considering?
Yes, this is duplicate of #16735.
--
Ticket URL: <https://code.djangoproject.com/ticket/24084#comment:1>