Hello,

i think this is the right answer:

from django.db.models import Sum

ModelName.objects.filter(field_name__isnull=True).aggregate(Sum('field_name'))#
returns {'field_name__sum': 1000} for example


Am So., 13. Juni 2021 um 12:04 Uhr schrieb www.forum-gh.com <
ladamo...@gmail.com>:

> Hello friends
> please i have: conversion_fqctor = models.charfield(choices=FACTOR)
>
> i want to sum the conversion_factor inside my view.py how do i convert it
> to a decimal and use the Sum()
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALYpPT8_5sMsyjzvpdGZ3gBQbqiwQW7EHgZ61i4LdLQ1z38LYg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALYpPT8_5sMsyjzvpdGZ3gBQbqiwQW7EHgZ61i4LdLQ1z38LYg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9mzh5hoTgESsxFiUtkT_S-cPvTSjNGp-zUAfSwSptAaZJw%40mail.gmail.com.

Reply via email to