https://mefiz.com/ # For Developer # Django merge duplicate rows from django.db.models import Sum YourModel.objects.values('name', 'user_id').annotate(total=Sum('amount')).values('name', 'user_id', 'total')