db.models.functions.Upper

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

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

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

Usage example:

>>> from django.db.models.functions import Upper
>>> Author.objects.create(name='Margaret Smith')
>>> author = Author.objects.annotate(name_upper=Upper('name')).get()
>>> print(author.name_upper)
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:46
Comments
Leave a Comment

Please login to continue.