I have a model as follows:
class Task(models.Model):
value= models.IntegerField()
data = models.CharField(max_length=50, blank=True)
I want to make a query to return the sum of the values for every distinct data. I tried the following but it didn't work:
Task.objects.all().distinct('data').annotate(value = Sum('value'))
I was getting this error:
NotImplementedError: annotate() + distinct(fields) not implemented.
values to cosider (from the set of task with identicaldata)?