Ordering and Slicing
order_by sorts and slices limit.
Example
Post.objects.order_by("-created")[:5]
Post.objects.order_by("title", "-views")Exercise
Newest first.
order_by("created")
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.