'Cook the value'

def _prepare_value(self, value, dj_field=None):

    from django.db import models
    if isinstance(value, (six.string_types, int, float)):
        return value
    elif isinstance(value, SimpleLazyObject):
        return value.pk
    elif isinstance(value, models.Model):
        if dj_field:
            if isinstance(dj_field, models.ForeignKey):
                return value.pk
        return value
    elif isinstance(value, (ResultSet, EmptyQuerySet, EmptyResultSet, list)):
        return [self._prepare_value(v, dj_field=dj_field) for v in value]
    elif isinstance(value, QuerySet):
        value = value._clone()
        return [self._prepare_value(v, dj_field=dj_field) for v in value]
    return value
