I am working on an open source Django time tracking application, Djime , and I'm trying to come up with a more efficient way to get statistics. So far, we had a rather long procedural code that would receive all TimeSlices for a certain period of time and put them together in a huge nested mess in the list / dictionaries.
What I would like to do is create a more efficient system - an object or function that will execute the QuerySet from TimeSlices and map them using the user, task and / or day.
Our model looks like this (simplified):
class TimeSlice(models.Model):
task = models.ForeignKey(Task)
user = models.ForeignKey(User)
begin = models.DateTimeField(default=datetime.datetime.now)
duration = models.PositiveIntegerField(null=True, blank=True)
note = models.TextField(null=True, blank=True)
source
share