diff --git a/apps/ops/models/adhoc.py b/apps/ops/models/adhoc.py index 95a1106b1..aa2884105 100644 --- a/apps/ops/models/adhoc.py +++ b/apps/ops/models/adhoc.py @@ -180,8 +180,10 @@ class AdHoc(OrgModelMixin): def run(self): try: hid = current_task.request.id + if AdHocExecution.objects.filter(id=hid).exists(): + hid = uuid.uuid4() except AttributeError: - hid = str(uuid.uuid4()) + hid = uuid.uuid4() execution = AdHocExecution( id=hid, adhoc=self, task=self.task, task_display=str(self.task)[:128], diff --git a/apps/ops/utils.py b/apps/ops/utils.py index e4fa85812..04d35a2fa 100644 --- a/apps/ops/utils.py +++ b/apps/ops/utils.py @@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _ from common.utils import get_logger, get_object_or_none from common.tasks import send_mail_async -from orgs.utils import tmp_to_org, org_aware_func +from orgs.utils import org_aware_func from .models import Task, AdHoc