db.models.functions.Lower

class Lower(expression, **extra) [source]

Accepts a single text field or expression and returns the lowercase representation.

It can also be registered as a transform as described in Length.

Usage example:

>>> from django.db.models.functions import Lower
>>> Author.objects.create(name='Margaret Smith')
>>> author = Author.objects.annotate(name_lower=Lower('name')).get()
>>> print(author.name_lower)
margaret smith
Changed in Django 1.9:

The ability to register the function as a transform was added.

doc_Django
2016-10-09 18:35:45
Comments
Leave a Comment

Please login to continue.