@receiver(project_import)
def handle_project_import(sender, **kwargs):
    'Add post-commit hook on project import'
    project = sender
    request = kwargs.get('request')
    for service_cls in registry:
        if service_cls.is_project_service(project):
            service = service_cls.for_user(request.user)
            if (service is not None):
                if service.setup_webhook(project):
                    messages.success(request, _('Webhook activated'))
                else:
                    messages.error(request, _('Webhook configuration failed'))
Add post-commit hook on project import
@receiver(project_import)
def handle_project_import(sender, **kwargs):
    
    project = sender
    request = kwargs.get('request')
    for service_cls in registry:
        if service_cls.is_project_service(project):
            service = service_cls.for_user(request.user)
            if (service is not None):
                if service.setup_webhook(project):
                    messages.success(request, _('Webhook activated'))
                else:
                    messages.error(request, _('Webhook configuration failed'))