Django values_list() lowercase

Reventlow

I have query set that I am exporting to CSV.

models.One2OneInfoLog.objects.filter(one_2_one_info=pk).values_list('name', 'location', 'created').order_by('created')

I want the 'name' field to be in lowercase. Is their a way to do that?

afonso

You can use the Database Function 'Lower' to convert to lowercase:

from django.db.models.functions import Lower

models.One2OneInfoLog.objects.filter(one_2_one_info=pk).values_list(Lower('name'), 'location', 'created').order_by('created')

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Django retrieve get_foo_value within values_list and annotate query

Django values_list vs values

Does Django queryset values_list return a list object?

Django ORM values_list with '__in' filter performance

R Convert list to lowercase

How to use a list inside values_list() in django?

Django - How to add a value to each tuple in values_list

Lowercase a list of lists

Which is a more efficient method, using a list comprehension or django's 'values_list' function?

Django template: How to use values/values_list

Django: ValueError: Prefetch querysets cannot use raw(), values(), and values_list()

how to filter values_list in django

Change a list of strings to lowercase

Producing a list by summing results of 'values_list' in Django queryset

How does values_list django work?

Django Template: How to display the value of Foreign Key in a values_list

Getting localtime with values_list in django

Is it possible to combine multiple values_list() in Django?

Python list comprehension and lowercase

Does Django makes additional query on accessing prefetched M2M field through "values()" or "values_list()"?

Django values_list extremely slow on large dataset

Converting a list to lowercase in Python

Django ORM: How to use count method inside values_list method?

Django - Redirect uppercase urls to lowercase

if a lowercase element is in the list without changing the list to lowercase

Lowercase Field values django models queryset

Create a list using values_list() in django

django values_list() and image reverse foreign key

count all objects within a values_list Django