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)
Search backward starting at the current line and moving up
dataset/ETHPy150Open yourlabs/django-autocomplete-light/src/dal_contenttypes/fields.py/ContentTypeModelFieldMixin.prepare_value--crossover with--dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/site-packages/pyreadline/lineeditor/history.py/LineHistory.non_incremental_reverse_search_history