79710367

Date: 2025-07-22 11:28:02
Score: 1
Natty:
Report link

The elegant way to fetch the the latest 10 messages and reserves them in python is:

latest_messages = list(Messages.objects.filter(since=since).order_by('-id')[:10])[::-1]

and the front end will get in ascending order.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ahmad Minhas