diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-12-28 19:18:48 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-12-28 19:18:48 +0000 |
| commit | bf5125734ebb9148eb455c05dbc872876f91e2b8 (patch) | |
| tree | 9d8d4f97a6d92c7e31f2f2bb8fd472abf562959a /docs/db-api.txt | |
| parent | de72616ac09b1d3b1da32e53ea02809e9bde5428 (diff) | |
Added note to docs/db-api.txt about using distinct=True with get_values()
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/db-api.txt')
| -rw-r--r-- | docs/db-api.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt index a83b7dad6a..bb0011d6e2 100644 --- a/docs/db-api.txt +++ b/docs/db-api.txt @@ -398,7 +398,11 @@ which rows are returned. Both ``limit`` and ``offset`` should be integers which will be directly passed to the SQL ``LIMIT``/``OFFSET`` commands. If ``distinct`` is True, only distinct rows will be returned. This is equivalent -to a ``SELECT DISTINCT`` SQL clause. +to a ``SELECT DISTINCT`` SQL clause. You can use this with ``get_values()`` to +get distinct values. For example, this returns the distinct first_names:: + + >>> people.get_values(fields=['first_name'], distinct=True) + [{'first_name': 'Adrian'}, {'first_name': 'Jacob'}, {'first_name': 'Simon'}] Other lookup options ==================== |
