mirror of
https://github.com/django/django.git
synced 2025-12-15 21:45:20 +00:00
Clarified StrIndex docs example.
This commit is contained in:
parent
2d4ccac275
commit
4a908c0cd2
1 changed files with 2 additions and 3 deletions
|
|
@ -259,10 +259,9 @@ Usage example::
|
|||
>>> Author.objects.create(name='Margaret Smith')
|
||||
>>> Author.objects.create(name='Smith, Margaret')
|
||||
>>> Author.objects.create(name='Margaret Jackson')
|
||||
>>> authors = Author.objects.annotate(
|
||||
>>> Author.objects.filter(name='Margaret Jackson').annotate(
|
||||
... smith_index=StrIndex('name', V('Smith'))
|
||||
... ).order_by('smith_index')
|
||||
>>> authors.first().smith_index
|
||||
... ).get().smith_index
|
||||
0
|
||||
>>> authors = Author.objects.annotate(
|
||||
... smith_index=StrIndex('name', V('Smith'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue