def set_to_cache(self):
        queryset = self.get_queryset()
        cache.set(self._get_cache_key(), {
            'queryset':
                [
                    queryset.none(),
                    queryset.query,
                ],
            'cls': self.__class__,
            'search_fields': self.search_fields,
            'max_results': self.max_results,
            'url': self.get_url(),
        })
Add widget's attributes to Django's cache.
dataset/ETHPy150Open applegrew/django-select2/django_select2/forms.py/ModelSelect2Mixin.set_to_cache