old_contents: from django.views.generic.detail import DetailView
  from django.views.generic.list import ListView
  
  from packages.models import Package
  
  
  class PackageIndex(ListView):
      queryset = Package.objects.all().order_by("name")
      template_name = "packages/simple/package_list.html"
  
  
  class PackageDetail(DetailView):
      model = Package
      slug_field = "name"
      template_name = "packages/simple/package_detail.html"
  
new_contents: from django.views.generic.detail import DetailView
  from django.views.generic.list import ListView
  
  from packages.models import Package
  
  
  class PackageIndex(ListView):
      queryset = Package.objects.all().order_by("name")
      template_name = "packages/simple/package_list.html"
  
  
  class PackageDetail(DetailView):
      queryset = Package.objects.all().prefetch_related("releases__uris", "releases__files")
      slug_field = "name"
      template_name = "packages/simple/package_detail.html"
  
subject: use prefetch related to bring queries to O(1) instead of O(n)