[Answer]-Django–change datetime field to a date field

1👍

Reposting my answer here:

Get daily counts of objects from Django

(Arrival.objects
    # get specific dates (not hours for example) and store in "created" 
    .extra({'created':"date(time)"})
    # get a values list of only "created" defined earlier
    .values('created')
    # annotate each day by Count of Arrival objects
    .annotate(created_count=Count('id')))

Leave a comment