mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #21181 -- Added Collate database function.
Thanks Simon Charette for reviews.
This commit is contained in:
committed by
Mariusz Felisiak
parent
60626162f7
commit
63300f7e68
@@ -87,6 +87,25 @@ Usage examples::
|
||||
>>> now = timezone.now()
|
||||
>>> Coalesce('updated', Cast(now, DateTimeField()))
|
||||
|
||||
``Collate``
|
||||
-----------
|
||||
|
||||
.. class:: Collate(expression, collation)
|
||||
|
||||
.. versionadded:: 3.2
|
||||
|
||||
Takes an expression and a collation name to query against.
|
||||
|
||||
For example, to filter case-insensitively in SQLite::
|
||||
|
||||
>>> Author.objects.filter(name=Collate(Value('john'), 'nocase'))
|
||||
<QuerySet [<Author: John>, <Author: john>]>
|
||||
|
||||
It can also be used when ordering, for example with PostgreSQL::
|
||||
|
||||
>>> Author.objects.order_by(Collate('name', 'et-x-icu'))
|
||||
<QuerySet [<Author: Ursula>, <Author: Veronika>, <Author: Ülle>]>
|
||||
|
||||
``Greatest``
|
||||
------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user