def prepare_value(self, value):
        if not value:
            return ''

        if isinstance(value, six.string_types):
            # Apparently Django's ModelChoiceField also expects two kinds of
            # "value" to be passed in this method.
            return value

        return '%s-%s' % (ContentType.objects.get_for_model(value).pk,
                          value.pk)
Return a ctypeid-objpk string for value.
dataset/ETHPy150Open yourlabs/django-autocomplete-light/src/dal_contenttypes/fields.py/ContentTypeModelFieldMixin.prepare_value