When I create content, I have its equivalent in the languages added to my site in the DB.
So how to display only the last 3 articles of a single language on the home page using “ojects.all().order_by(‘-date’)[:3]”
def get_context(self, request):
# Update context to include only published posts, ordered by reverse-chron
context = super().get_context(request)
latest_insights = Insight.objects.all().order_by('-date')[:3]
context['latest_insights'] = latest_insights
return context
New contributor
Abdel GUEYE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.