Thank you Simon,
This func expression what was I looking for. However, some more complex queries with the date() function still confuse me.
For example the SQL query:
select count(distinct UniqueCallID), date(JoinTime) from Table group by date(JoinTime);
I tried to write it as:
calls = Call.objects.annotate(join_date=Func(F('jointime'), function='DATE'), count=Count('uniquecallid', distinct=True)).values('join_date', 'count')
But it seems that the group by is not working as expected and the values returned are not distinct. Am I missing something?