from django.db import models
from django.core.cache import cache
from django.conf import settings

from .utils import bitgroup_cache_key


class BitGroupManager(models.Manager):

    def get_group(self, slug):
        """ Retrieve a group by slug, with caching """
        key = bitgroup_cache_key(slug)
        cached_group = cache.get(key)

        if not cached_group:
            cached_group = self.get_queryset().select_related(
                'bits',
            ).prefetch_related('bits__data').get(slug=slug)

            timeout = getattr(settings, 'PAGEBITS_CACHE_TIMEOUT', 3600)

            cache.set(key, cached_group, int(timeout))

        return cached_group

from django.db import models
from django.core.cache import cache
from django.conf import settings

from .utils import bitgroup_cache_key


class BitGroupManager(models.Manager):

    def get_group(self, slug):
        """ Retrieve a group by slug, with caching """
        key = bitgroup_cache_key(slug)
        cached_group = cache.get(key)

        if not cached_group:
            cached_group = self.get_queryset() \
                .prefetch_related('bits__data').get(slug=slug)

            timeout = getattr(settings, 'PAGEBITS_CACHE_TIMEOUT', 3600)

            cache.set(key, cached_group, int(timeout))

        return cached_group

Remove select related. Django 1.8 requires existing fields instead of ignoring missing ones.
Remove select related. Django 1.8 requires existing fields instead of ignoring missing ones.
