1π
β
from datetime import timedelta
results = MyModel.objects.filter(
id=pk,
date__range=(start_time, end_time)
).values('my_id'
).annotate(max_time=Max('my_date_time'))
for result in results:
result['max_time'] -= timedelta(minutes=60)
π€f43d65
Source:stackexchange.com