# Path: rest_framework_extensions/compat.py
# def queryset_to_value_list(queryset):


from django.utils.translation import get_language
from django.db.models.query import EmptyQuerySet
from django.core.exceptions import EmptyResultSet
from django.utils.encoding import force_str
from rest_framework_extensions import compat
        from rest_framework_extensions.utils import prepare_header_name
                param = getattr(paginator, attr, None)
                if param:
                    kwargs['params'].append(param)

        return super().get_data(**kwargs)


class SqlQueryKeyBitBase(KeyBitBase):
    def _get_queryset_query_string(self, queryset):
        if isinstance(queryset, EmptyQuerySet):
            return None
        else:
            try:
                return force_str(queryset.query.__str__())
            except EmptyResultSet:
                return None


class ModelInstanceKeyBitBase(KeyBitBase):
    """
    Return the actual contents of the query set.
    This class is similar to the `SqlQueryKeyBitBase`.
    """

    def _get_queryset_query_values(self, queryset):
        if isinstance(queryset, EmptyQuerySet) or queryset.count() == 0:
            return None
        else:
            try:
                # run through the instances and collect all values in ordered fashion

# Path: rest_framework_extensions/compat.py
# def queryset_to_value_list(queryset):


# Path: rest_framework_extensions/key_constructor/bits.py
from django.utils.translation import get_language
from django.db.models.query import EmptyQuerySet
from django.core.exceptions import EmptyResultSet
from django.utils.encoding import force_str
from rest_framework_extensions import compat
        from rest_framework_extensions.utils import prepare_header_name

                param = getattr(paginator, attr, None)
                if param:
                    kwargs['params'].append(param)

        return super().get_data(**kwargs)


class SqlQueryKeyBitBase(KeyBitBase):
    def _get_queryset_query_string(self, queryset):
        if isinstance(queryset, EmptyQuerySet):
            return None
        else:
            try:
                return force_str(queryset.query.__str__())
            except EmptyResultSet:
                return None


class ModelInstanceKeyBitBase(KeyBitBase):
    """
    Return the actual contents of the query set.
    This class is similar to the `SqlQueryKeyBitBase`.
    """

    def _get_queryset_query_values(self, queryset):
        if isinstance(queryset, EmptyQuerySet) or queryset.count() == 0:
            return None
        else:
            try:
                # run through the instances and collect all values in ordered fashion

                return compat.queryset_to_value_list(force_str(queryset.values_list()))