Permalink
Browse files

Fixed #25132 -- Documented how to retrieve a single value using value…

…s_list() and get().
  • Loading branch information...
1 parent ebd26bf commit 4373eac99828d99718a7b245d160e7e64fce2e95 @alexmorozov alexmorozov committed with timgraham Nov 2, 2015
Showing with 6 additions and 0 deletions.
  1. +6 −0 docs/ref/models/querysets.txt
@@ -625,6 +625,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'
+
dates
~~~~~

0 comments on commit 4373eac

Please sign in to comment.