You’re probably looking for aggregate
from django.db.models import Sum
ItemPrice.objects.aggregate(Sum('price'))
# returns {'price__sum': 1000} for example
More Related Contents:
- Django CSRF check failing with an Ajax POST request
- Having Django serve downloadable files
- How can I enable CORS on Django REST Framework
- Django URLs TypeError: view must be a callable or a list/tuple in the case of include()
- Error on “pip install -U channels” command using for otree (Running setup.py bdist_wheel for twisted … error)
- Django Rest Framework File Upload
- Split views.py in several files
- How to execute a GROUP BY … COUNT or SUM in Django ORM?
- Any way to make {% extends ‘…’ %} conditional? – Django
- How do I add a placeholder on a CharField in Django?
- is there a way to loop over two lists simultaneously in django?
- Is it better to use path() or url() in urls.py for django 2.0?
- Django DateField default options
- MySQL Improperly Configured Reason: unsafe use of relative path
- How to get value from form field in django framework?
- No Module named django.core
- How do I prevent fixtures from conflicting with django post_save signal code?
- Do properties work on Django model fields?
- What’s the best solution for OpenID with Django? [closed]
- How can I get the current language in Django?
- QuerySet, Object has no attribute id – Django
- How to update manytomany field in Django?
- Django ‘AnonymousUser’ object has no attribute ‘_meta’
- Install mysqlclient for Django Python on Mac OS X Sierra
- Add “django-admin.py” path to command line on Windows 7
- Django Multiple Databases – relation does not exist; LINE 1: SELECT COUNT(*) AS “__count” FROM
- How to get more diagnostic output on a “no module named xyz” error?
- How do I change the range of the x-axis with datetime?
- Django admin: How to display the field marked as “editable=False” in the model?
- How to solve “Page not found (404)” error in Django?