Answer the question
In order to leave comments, you need to log in
How to display the last 3 objects in Django?
Hello.
Task: display on page 3 the latest reviews related to this article.
mentionship = Mention.objects.filter(mentionn_id = step_id)[-3:0] #Не работает
Answer the question
In order to leave comments, you need to log in
Mention.objects.filter(mentionn_id=step_id).order_by('-pk')[:3]
If no such ordering is defined for a given QuerySet, calling reverse() on it has no real effect
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question