[Answered ]-Returning a scalar from a Django function

1👍

You can make an ORM query which looks like:

from django.db.models import IntegerField, Sum
from django.db.models.functions import Cast

pts = skills.objects.filter(
    creator=request.user, status='closed'
).aggregate(
    total=Sum(Cast('points', output_field=IntegerField()))
)['total']

Leave a comment