def to_python(self, value):
        if value in self.empty_values:
            return None
        try:
            key = self.to_field_name or 'pk'
            value = self.queryset.get(**{key: value})
        except (__HOLE__, self.queryset.model.DoesNotExist):
            raise ValidationError(self.error_messages['invalid_choice'], code='invalid_choice')
        return value
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/forms/models.py/ModelChoiceField.to_python