def to_internal_value(self, data):
        """Convert to internal value."""
        user = getattr(self.context.get('request'), 'user')
        queryset = self.get_queryset()
        permission = get_full_perm('view', queryset.model)
        try:
            return get_objects_for_user(
                user,
                permission,
                queryset.filter(**{self.slug_field: data}),
            ).latest()
        except ObjectDoesNotExist:
            self.fail(
                'does_not_exist',
                slug_name=self.slug_field,
                value=smart_text(data),
                model_name=queryset.model._meta.model_name,  # pylint: disable=protected-access
            )
        except (TypeError, ValueError):
            self.fail('invalid')
Convert to internal value.