def set_to_cache(self):
        """
        Add widget's attributes to Django's cache.

        Split the QuerySet, to not pickle the result set.
        """
        queryset = self.get_queryset()
        cache.set(self._get_cache_key(), {
            'queryset':
                [
                    queryset.none(),
                    queryset.query,
                ],
            'cls': self.__class__,
            'search_fields': tuple(self.search_fields),
            'max_results': int(self.max_results),
            'url': str(self.get_url()),
            'dependent_fields': dict(self.dependent_fields),
        })
Add widget's attributes to Django's cache.

        Split the QuerySet, to not pickle the result set.