I have learned we can sum all(or filtered) columns like price from this question.
ItemPrice.objects.aggregate(Sum('price'))
But is it possible for Django to sum non numetric field’s length, such as CharField or JSONField? A pseudocode is like following.
User.objects.aggregate(Sum(len('username')))
>Solution :
from django.db.models.functions import Length
from django.db.models import Sum
User.objects.annotate(l=Length("username")).aggregate(Sum("l"))