1
You can try the below code.
from django.db import connection
truncate_date = connection.ops.date_trunc_sql('month', 'time_stamp')
report = Transaction.objects.extra({'month':truncate_date}).values('month').annotate(last_record=Max('time_stamp'))
Source:stackexchange.com