Fixes: 1) Update return type of `create_object` to `Any`; Extra: 1) Remove unused fields (`icon`, `priority`, `hide`) from `blog.apps`; 2) Update API URLs to include `version` endpoint; 3) Miscellaneous cleanup and comments.
16 lines
714 B
Python
16 lines
714 B
Python
from typing import Type
|
|
|
|
from core.models import Vendor
|
|
from core.vendors import AbstractVendor
|
|
from evibes.utils.misc import create_object
|
|
|
|
|
|
def get_vendors_integrations(name: str | None = None) -> list[Type[AbstractVendor]]:
|
|
vendors_integrations: list[Type[AbstractVendor]] = []
|
|
vendors = Vendor.objects.filter(is_active=True, name=name) if name else Vendor.objects.filter(is_active=True)
|
|
for vendor in vendors:
|
|
if vendor.integration_path:
|
|
module_name = ".".join(vendor.integration_path.split(".")[:-1])
|
|
class_name = vendor.integration_path.split(".")[-1]
|
|
vendors_integrations.append(create_object(module_name, class_name))
|
|
return vendors_integrations
|