[Django]-Django – Is there a way to find the maximum/minimum value of a field from models without using an iterator?

9👍

This doc is about how aggregation works in Django. For instance, for your Record model class you can compute the min and max value for price attribute using the following syntax:

from django.db.models import Min, Max

Record.objects.annotate(Min("price"), Max("price"))

Leave a comment