[1] https://docs.djangoproject.com/en/4.1/ref/models/querysets/#latest
On February 27, 2023 2:51:58 AM CST, Byansi Samuel <samuelbyansi87@gmail.com> wrote:
I got a problem with my queryset. Am trying to get 4 latest objects from my model but it returns 1 objects the top latest.
Below is my code. Any support and guidance is appreciated.
#action/views.py
from Action.models import ActionGame
latest_action= [ActionGame.objects.filter (os='windows', category='action').latest ('published_date')][:4]
Buy the problem is that it returns 1 object yet l need 4 objects
What can I do to solve it?
No comments:
Post a Comment