#19360: annotate the sum of related TimeField
-------------------------------+--------------------
Reporter: lsaffre | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I get a "TypeError: expected string or buffer" when I try to annotate the
sum of a timefield in a related model.
{{{
class Ticket(models.Model):
name = models.CharField(max_length=200)
class Session(models.Model):
ticket = models.ForeignKey(Ticket,related_name="sessions")
time = models.TimeField()
qs = Ticket.objects.annotate(timesum=models.Sum('sessions__time'))
print [unicode(t.timesum) for t in qs]
}}}
Please see the attached files for a complete test case.
--
Ticket URL: <https://code.djangoproject.com/ticket/19360>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.