Get a value from QuerySet MultiDict
329734
def qs_get(self, key, default=None):
        ''''''
        return self.query.get(key, default=default)
293293
def filter_queryset(self, value, queryset):
        
        filter_kwargs = {self.field_name: value}
        return queryset.filter(**filter_kwargs)
885580
def parse_values(self, query):
        
        values = {}
        for name, filt in self.filters.items():
            val = filt.parse_value(query)
            if val is None:
                continue
            values[name] = val
        return values
897032
def queryset(self, request, queryset):
        
        if self.value():
            parent = Question.objects.get(slug=self.value())
            return Choice.objects.child_of(parent).order_by('-id')
        return queryset
1072202
def get_value(self, meta, base_model_meta, mcs_args: McsArgs):
        """"""
        if mcs_args.Meta.abstract:
            return None
        value = getattr(base_model_meta, self.name, {}) or {}
        value.update(getattr(meta, self.name, {}))
        return value
61048
def queryset(self, request, queryset):
        """"""
        if self.form.is_valid():
            # get no null params
            filter_params = dict(
                filter(lambda x: bool(x[1]), self.form.cleaned_data.items())
            )
            return queryset.filter(**filter_params)
        return queryset
728415
def get_rank_value(cls, name):
    
    if name in cls._RANK_NAMES.values():
      return getattr(cls, name, None)
    return None
60345
def filter_queryset(self, queryset):
        
        for name, filt in self.filters.items():
            val = self.values.get(name, None)
            if name is None:
                continue
            params = filt.filter_params(val)
            if not params:
                continue
            if isinstance(params, dict):
                queryset = queryset.filter(**params)
            if isinstance(params, QNode):
                queryset = queryset.filter(params)
        return queryset
642743
def dict_to_querystring(dictionary):
    """"""
    s = u""
    for d in dictionary.keys():
        s = unicode.format(u"{0}{1}={2}&", s, d, dictionary[d])
    return s[:-1]
1216047
def by_name(queryset, name=None):
  
  if name:
    queryset = queryset.filter(name=name)
  return queryset
560529
def parse_querystring(self, req, name, field):
        """"""
        return get_value(req.query_arguments, name, field)
287368
def _get_dataobject(self, name, multivalued):
        """"""
        logger.debug("Querying server for uncached data object %s", name)
        # This will retrieve the value and inject it into the cache
        self.update_view_data(properties=[name])
        return self._cache[name][0]
492556
def get_queryset(self, queryset=None):
        
        serializer = self.get_serializer()
        return getattr(self, 'queryset', serializer.Meta.model.objects.all())
679169
def get_value(self, key, args, kwargs):
        """"""
        if (self.tolerant and
                not isinstance(key, basestring) and
                key not in kwargs):
            key = str(key)

        return kwargs[key]
775052
def queryset_to_dict(qs, key='pk', singular=True):
    
    if singular:
        result = {}
        for u in qs:
            result.setdefault(getattr(u, key), u)
    else:
        result = defaultdict(list)
        for u in qs:
            result[getattr(u, key)].append(u)
    return result
1374273
def querystring(self):
        
        return {key: value for (key, value) in self.qs.items()
                if key.startswith(self.MANAGED_KEYS) or self._get_key_values('filter[')}
1312565
def get_object(self, view_name, view_args, view_kwargs):
        
        lookup_value = view_kwargs[self.lookup_url_kwarg]
        lookup_kwargs = {self.lookup_field: lookup_value}
        return self.get_queryset().get(**lookup_kwargs)