原生SQL
SELECT order_id,city,locality,login_time,sum(morning_hours),sum(afternoon_hours),sum(evening_hours),sum(total_hours)
FROM orders
GROUPBY order_id,city,locality,login_timegroup by … sum
from django.db.models import SumYour_Model.objects.values(…