def delete(self, *args, **kwargs):
        if not self.deletable:
            from moztrap.model import ProductVersion
            raise models.ProtectedError(
                "Environment '{0}' is in use and cannot be deleted.".format(
                    str(self)),
                list(ProductVersion.objects.filter(environments=self).all())
                )
        return super(Environment, self).delete(*args, **kwargs)
Delete this environment, or raise ProtectedError if its in use.
dataset/ETHPy150Open mozilla/moztrap/moztrap/model/environments/models.py/Environment.delete