1👍
✅
I think it should be like this
AdvertShowEvent.objects.filter(user=user).values('advertis*m*nt').annotate(Max('datetime'), id=MAX('id')).values_list('id', flat=True)
Source:stackexchange.com