Return the filtered queryset based on the value provided in the query string.

		source: https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
767536
def queryset(self, request, queryset):
		
		filter_args = {self._filter_arg_key: None}

		if self.value() == "yes":
			return queryset.exclude(**filter_args)
		if self.value() == "no":
			return queryset.filter(**filter_args)
616048
def filter_facet_queryset(self, queryset):
        
        for backend in list(self.facet_filter_backends):
            queryset = backend().filter_queryset(self.request, queryset, self)

        if self.load_all:
            queryset = queryset.load_all()

        return queryset
989435
def for_model(self, model):
        
        ct = ContentType.objects.get_for_model(model)
        qs = self.get_queryset().filter(content_type=ct)
        if isinstance(model, models.Model):
            qs = qs.filter(object_pk=force_text(model._get_pk_val()))
        return qs
1125470
def get_queryset(self):
        
        qs = VersionedQuerySet(self.model, using=self._db)
        if hasattr(self, 'instance') and hasattr(self.instance, '_querytime'):
            qs.querytime = self.instance._querytime
        return qs
588838
def get_filterset_kwargs(self, request, queryset, view):
        
        filter_keys = []
        # rewrite filter[field] query params to make DjangoFilterBackend work.
        data = request.query_params.copy()
        for qp, val in request.query_params.items():
            m = self.filter_regex.match(qp)
            if m and (not m.groupdict()['assoc'] or
                      m.groupdict()['ldelim'] != '[' or m.groupdict()['rdelim'] != ']'):
                raise ValidationError("invalid query parameter: {}".format(qp))
            if m and qp != self.search_param:
                if not val:
                    raise ValidationError("missing {} test value".format(qp))
                # convert jsonapi relationship path to Django ORM's __ notation
                key = m.groupdict()['assoc'].replace('.', '__')
                # undo JSON_API_FORMAT_FIELD_NAMES conversion:
                key = format_value(key, 'underscore')
                data[key] = val
                filter_keys.append(key)
                del data[qp]
        return {
            'data': data,
            'queryset': queryset,
            'request': request,
            'filter_keys': filter_keys,
        }
1028209
def _get_content_type_queryset(models_list):
    
    content_type_ids = {c.id for c in ContentType.objects.get_for_models(*models_list).values()}
    return ContentType.objects.filter(id__in=content_type_ids)
832678
def filter_queryset(self, request, queryset, view):
        """"""
        start_value = self.get_start(request)
        if start_value:
            queryset = self.apply_published_filter(queryset, "after", start_value)
        end_value = self.get_end(request)
        if end_value:
            # Forces the end_value to be the last second of the date provided in the query.
            # Necessary currently as our Published filter for es only applies to gte & lte.
            queryset = self.apply_published_filter(queryset, "before", end_value)
        return queryset
1367991
def get_queryset(self):
        """"""
        if 'sign' in self.request.query_params:
            try:
                filter_and_actions = unsign_filters_and_actions(
                    self.request.query_params['sign'],
                    '{}.{}'.format(
                        self.queryset.model._meta.app_label,
                        self.queryset.model._meta.model_name,
                    )
                )
            except signing.BadSignature:
                return super(SignedViewSetMixin, self).get_queryset()
            else:
                for filtered_action in filter_and_actions:
                    try:
                        qs = self.queryset.filter(**filtered_action['filters'])
                    except FieldError:
                        continue
                    return qs
        return super(SignedViewSetMixin, self).get_queryset()
1339822
def index_queryset(self, using=None):
        
        translation.activate(settings.LANGUAGE_CODE)
        return self.get_model().objects.filter(status=UrlNode.PUBLISHED).select_related()
1121525
def queryset(self, request, queryset):
        
        if self.value() is not None:
            return queryset.filter(user__pk=self.value())
        else:
            return queryset
240173
def get_queryset(self):
        
        queryset    = super(IndexView, self).get_queryset()
        search_form = self.get_search_form()

        if search_form.is_valid():
            query_str   = search_form.cleaned_data.get('q', '').strip()
            queryset    = self.model.objects.search(query_str)

        return queryset
360414
def by_published(queryset, published_string='true'):
  
  if published_string == 'true':
    queryset = queryset.filter(published=1)
  elif published_string == 'false':
    queryset = queryset.filter(published=0)
  # Any other value will return both published and unpublished
  return queryset
11749
def get_queryset(self, *args, **kwargs):
        
        qs = super(TreeManager, self).get_queryset(*args, **kwargs)

        # Restrict operations to pages on the current site if needed
        if settings.PAGES_HIDE_SITES and settings.PAGES_USE_SITE_ID:
            return qs.order_by(self.tree_id_attr, self.left_attr).filter(sites=settings.SITE_ID)
        else:
            return qs.order_by(self.tree_id_attr, self.left_attr)
914528
def get_queryset(self, request):
        """"""
        qs = super(TaskAdmin, self).get_queryset(request)
        return qs.filter(success=True)
880214
def get_queryset(self):
        """"""
        kwargs = {
            model_field_name: self.request.GET.get(form_field_name)
            for form_field_name, model_field_name in self.widget.dependent_fields.items()
            if form_field_name in self.request.GET and self.request.GET.get(form_field_name, '') != ''
        }
        return self.widget.filter_queryset(self.request, self.term, self.queryset, **kwargs)
922517
def queryset(self, request):
        
        qs = super(MultilingualInlineAdmin, self).queryset(request)
        # Don't now what the hell I was thinking here, but this code breaks stuff:
        #
        # checkfield = self.get_fill_check_field()
        # if checkfield is not None:
        #     kwargs = {str('%s_%s__isnull' % (checkfield, GLL.language_code)): False}
        #     from django.db.models.fields import CharField
        #     if isinstance(self.model._meta.translation_model._meta.get_field_by_name(checkfield)[0], CharField):
        #         kwargs[str('%s_%s__gt' % (checkfield, GLL.language_code))] = ''
        #     return qs.filter(**kwargs)
        return qs.filter(translations__language_code=GLL.language_code).distinct()
1127734
def list(self, **filters):
        
        LOG.debug(u'Querying %s by filters=%s', self.model_class.__name__, filters)
        query = self.__queryset__()
        perm = build_permission_name(self.model_class, 'view')
        LOG.debug(u"Checking if user %s has_perm %s" % (self.user, perm))
        query_with_permission = filter(lambda o: self.user.has_perm(perm, obj=o), query)
        ids = map(lambda o: o.pk, query_with_permission)

        # FIXME: Return to query again without use database
        queryset = self.__queryset__().filter(pk__in=ids)
        related = getattr(self, 'select_related', None)
        if related:
            queryset = queryset.select_related(*related)

        return queryset