@cronjobs.register
def update_collections_total():
 d = CollectionCount.objects.values('collection_id').annotate(sum=Sum('count'))
 ts = [tasks.update_collections_total.subtask(args=[chunk]) for chunk in chunked(d, 50)]
 TaskSet(ts).apply_async()

@ cronjobs . register def update_collections_total ( ) : d = CollectionCount . objects . values ( 'collection_id' ) . annotate ( sum = Sum ( 'count' ) ) ts = [ tasks . update_collections_total . subtask ( args = [ chunk ] ) for chunk in chunked ( d , 50 ) ] TaskSet ( ts ) . apply_async ( )
update collections downloads totals .