Browse files

[1.9.x] Fixed #25132 -- Documented how to retrieve a single value usi…

…ng values_list() and get().

Backport of 4373eac from master
  • Loading branch information...
alexmorozov authored and timgraham committed Nov 2, 2015
1 parent a3bbc38 commit ecb3e314cb0ce4b7fe65e208ea76557443ae6e06
Showing with 6 additions and 0 deletions.
  1. +6 −0 docs/ref/models/querysets.txt
@@ -641,6 +641,12 @@ It is an error to pass in ``flat`` when there is more than one field.
If you don't pass any values to ``values_list()``, it will return all the
fields in the model, in the order they were declared.
+A common need is to get a specific field value of a certain model instance. To
+achieve that, use ``values_list()`` followed by a ``get()`` call::
+ >>> Entry.objects.values_list('headline', flat=True).get(pk=1)
+ 'First entry'

0 comments on commit ecb3e31

Please sign in to comment.