registrasion/controllers/conditions.py
def pre_filter(self, queryset, user):
        ''' Returns all of the items from queryset where the user has a
        product from a category invoking that item's condition in one of their
        carts. '''

        in_user_carts = Q(
            enabling_category__product__productitem__cart__user=user
        )
        released = commerce.Cart.STATUS_RELEASED
        in_released_carts = Q(
            enabling_category__product__productitem__cart__status=released
        )
        queryset = queryset.filter(in_user_carts)
        queryset = queryset.exclude(in_released_carts)

        return queryset
def pre_filter(self, queryset, user):
        ''' Returns all of the items from queryset where the user has a
        product from a category invoking that item's condition in one of their
        carts. '''

        in_user_carts = Q(
            enabling_category__product__productitem__cart__user=user
        )
        released = commerce.Cart.STATUS_RELEASED
        in_released_carts = Q(
            enabling_category__product__productitem__cart__status=released
        )
        queryset = queryset.filter(in_user_carts)
        queryset = queryset.exclude(in_released_carts)

        return queryset
Returns all of the items from queryset where the user has a
        product from a category invoking that item's condition in one of their
        carts.