Closed mortenthansen closed 7 months ago
Change from:
def bulk_create(self, objs, *args, **kwargs): tenant = get_current_tenant() for obj in objs: setattr(obj, field_name, tenant) return super().bulk_create(objs, *args, **kwargs)
to
def bulk_create(self, objs, *args, **kwargs): tenant = get_current_tenant() if tenant: for obj in objs: setattr(obj, field_name, tenant) return models.Manager.bulk_create(self, objs, *args, **kwargs)
My use-case is the use of bulk_create with tenant_context_disabled() where I control the tenant myself with the objects parsed to bulk_create.
Change from:
to
My use-case is the use of bulk_create with tenant_context_disabled() where I control the tenant myself with the objects parsed to bulk_create.