from django.shortcuts import render

from foiidea.models import Article


def index(request):
    return render(request, 'foiidea/index.html', {
        'object_list': Article.objects.all().select_related('public_bodies', 'foirequests')
    })

from django.shortcuts import render

from foiidea.models import Article


def index(request):
    return render(request, 'foiidea/index.html', {
        'object_list': Article.objects.get_ordered()
    })

Use manager method for view articles
Use manager method for view articles
  from django.shortcuts import render
  
  from foiidea.models import Article
  
  
  def index(request):
      return render(request, 'foiidea/index.html', {
-         'object_list': Article.objects.all().select_related('public_bodies', 'foirequests')
+         'object_list': Article.objects.get_ordered()
      })
  
Use manager method for view articles
## Code Before:
from django.shortcuts import render

from foiidea.models import Article


def index(request):
    return render(request, 'foiidea/index.html', {
        'object_list': Article.objects.all().select_related('public_bodies', 'foirequests')
    })

## Instruction:
Use manager method for view articles
## Code After:
from django.shortcuts import render

from foiidea.models import Article


def index(request):
    return render(request, 'foiidea/index.html', {
        'object_list': Article.objects.get_ordered()
    })
