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"

@@ -309,21 +309,24 @@
 w):%0A    
-model
+queryset
  = Packa
@@ -327,16 +327,84 @@
  Package
+.objects.all().prefetch_related(%22releases__uris%22, %22releases__files%22)
 %0A    slu

use prefetch related to bring queries to O(1) instead of O(n)