'Returns a QuerySet object for querying the given model_class
with the given filter_data.  Optional special arguments in
filter_data include:
-query_start: index of first return to return
-query_limit: maximum number of results to return
-sort_by: list of fields to sort on.  prefixing a \'-\' onto a
field name changes the sort to descending order.
-extra_args: keyword args to pass to query.extra() (see Django
DB layer documentation)
-extra_where: extra WHERE clause to append
-no_distinct: if True, a DISTINCT will not be added to the SELECT'

@classmethod
def query_objects(cls, filter_data, valid_only=True, initial_query=None, apply_presentation=True):

    (special_params, regular_filters) = cls._extract_special_params(filter_data)
    if (initial_query is None):
        if valid_only:
            initial_query = cls.get_valid_manager()
        else:
            initial_query = cls.objects
    query = initial_query.filter(**regular_filters)
    use_distinct = (not special_params.get('no_distinct', False))
    if use_distinct:
        query = query.distinct()
    extra_args = special_params.get('extra_args', {})
    extra_where = special_params.get('extra_where', None)
    if extra_where:
        extra_where = cls.objects.escape_user_sql(extra_where)
        extra_args.setdefault('where', []).append(extra_where)
    if extra_args:
        query = query.extra(**extra_args)
        query = query._clone(klass=ReadonlyQuerySet)
    if apply_presentation:
        query = cls.apply_presentation(query, filter_data)
    return query
