In my quest to understand queries against Django models, I’ve been trying to get the last 3 added valid Avatar models with a query like:
newUserAv = Avatar.objects.filter(valid=True).order_by("date")[:3]
However, this instead gives me the first three avatars added ordered by date. I’m sure this is simple, but I’ve had trouble finding it in the Django docs: how do I select the last three avatar objects instead of the first three?
Put a hyphen before the field name.