def get_widget_or_404(self):
field_id = self.kwargs.get('<STR_LIT>', self.request.GET.get('<STR_LIT>', None))<EOL>if not field_id:<EOL><INDENT>raise Http404('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>key = signing.loads(field_id)<EOL><DEDENT>except BadSignature:<EOL><INDENT>raise Http404('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>cache_key = '<STR_LIT>' % (settings.SELECT2_CACHE_PREFIX, key)<EOL>widget_dict = cache.get(cache_key)<EOL>if widget_dict is None:<EOL><INDENT>raise Http404('<STR_LIT>')<EOL><DEDENT>if widget_dict.pop('<STR_LIT:url>') != self.request.path:<EOL><INDENT>raise Http404('<STR_LIT>')<EOL><DEDENT><DEDENT>qs, qs.query = widget_dict.pop('<STR_LIT>')<EOL>self.queryset = qs.all()<EOL>widget_dict['<STR_LIT>'] = self.queryset<EOL>widget_cls = widget_dict.pop('<STR_LIT>')<EOL>return widget_cls(**widget_dict)<EOL>
Get and return widget from cache.

Raises:
    Http404: If if the widget can not be found or no id is provided.

Returns:
    ModelSelect2Mixin: Widget from cache.