Django Basic Statistics Generation
Note: This is work in progress take this as some
Seen by hour (will show same device multiple times)
qs=models.RemoteBluetoothDeviceFoundRecord.objects.filter(time__isnull=False). # force SELECT time extra(select={'hour':"date_part('hour',time)"}) # extract minute qs.query.group_by=['remote_id','hour'] qs=qs.annotate(Count('remote')).order_by('hour') for hour,count,remote in qs.values_list('hour','remote__count','remote'): print hour,count,remote
page revision: 0, last edited: 11 Sep 2011 21:49