# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

from django.views.generic import DetailView, ListView

from .models import District


class DistrictListView(ListView):
    queryset = District.objects.all().select_related('county__name')


class DistrictDetailView(DetailView):
    queryset = District.objects.all().prefetch_related('stats__year')
    pk_url_kwarg = 'district_id'
    slug_url_kwarg = 'district_slug'

# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

from django.views.generic import DetailView, ListView

from .models import District


class DistrictListView(ListView):
    queryset = District.objects.all().defer('shape')


class DistrictDetailView(DetailView):
    queryset = District.objects.all().prefetch_related('stats__year')
    pk_url_kwarg = 'district_id'
    slug_url_kwarg = 'district_slug'

Remove unused select_related, defer the loading of shape for speed
Remove unused select_related, defer the loading of shape for speed
