accrete 0.0.97__py3-none-any.whl → 0.0.98__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
accrete/managers.py CHANGED
@@ -23,15 +23,18 @@ class TenantManager(models.Manager, AnnotationManagerMixin):
23
23
  tenant = get_tenant()
24
24
  if tenant is None and any(obj.tenant_id in (False, None) for obj in objs):
25
25
  raise ValueError(
26
- 'Tenant must be set for all objects when calling bulk_create'
26
+ 'Tenant must be set for all objects when calling '
27
+ 'bulk_create without an active tenant set.'
27
28
  )
29
+ list(map(
30
+ lambda x: setattr(x, 'tenant_id', tenant.pk),
31
+ filter(lambda o: o.tenant_id is None, objs)
32
+ ))
28
33
  if tenant is not None and any(obj.tenant_id != tenant.pk for obj in objs):
29
34
  raise ValueError(
30
- 'Objects must have set the same Tenant when calling bulk_create while a tenant is active'
35
+ 'Objects must have set the active Tenant when calling '
36
+ 'bulk_create while a tenant is active.'
31
37
  )
32
- elif tenant is not None:
33
- for obj in objs:
34
- obj.tenant_id = tenant.pk
35
38
  return super().bulk_create(
36
39
  objs, batch_size=batch_size, ignore_conflicts=ignore_conflicts,
37
40
  update_conflicts=update_conflicts, update_fields=update_fields,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: accrete
3
- Version: 0.0.97
3
+ Version: 0.0.98
4
4
  Summary: Django Shared Schema Multi Tenant
5
5
  Author-email: Benedikt Jilek <benedikt.jilek@pm.me>
6
6
  License: Copyright (c) 2023 Benedikt Jilek
@@ -4,7 +4,7 @@ accrete/annotation.py,sha256=GCpTTX3fJH9w2vOOOydKcAALdEd1gRNjh_Ws9LkJ4aA,1355
4
4
  accrete/apps.py,sha256=F7ynMLHJr_6bRujWtZVUzCliY2CGKiDvyUmL4F68L2E,146
5
5
  accrete/config.py,sha256=eJUbvyBO3DvAD6xkVKjTAzlXy7V7EK9bVyb91girfUs,299
6
6
  accrete/forms.py,sha256=2vUh80qNvPDD8Zl3agKBSJEQeY7bXVLOx_SAB34wf8E,1359
7
- accrete/managers.py,sha256=R-n2WRezhTNE-EVvhNSJ6TSCroN_TAHAWSJ_SS2jxpk,1451
7
+ accrete/managers.py,sha256=oZOA45HViNstaeIaGD2szg717DwByifW5GfvVsi4hOk,1561
8
8
  accrete/middleware.py,sha256=NhtT3YPq0EynAi4F81LLLUZd5rsWDjGVn1tkgUObT3M,3477
9
9
  accrete/models.py,sha256=xliEVR0XPW46ZDJn3-F46s54tG9dxz7BVLbkq1pC144,5434
10
10
  accrete/storage.py,sha256=z7pHdQFw0hFGrrbfqIh7KFxabQ_JGqoPebmiX9TLmeU,1254
@@ -233,7 +233,7 @@ accrete/utils/forms.py,sha256=IvxbXNpSd4a-JBgsTJhs2GHe-DCRWX-xnVPRcoiCzbI,3104
233
233
  accrete/utils/log.py,sha256=BH0MBDweAjx30wGBO4F3sFhbgkSoEs7T1lLLjlYZNnA,407
234
234
  accrete/utils/models.py,sha256=EEhv7-sQVtQD24PEb3XcDUAh3VVhVFoMMLyFrDjGEaI,706
235
235
  accrete/utils/views.py,sha256=iWZSYbd3qYMrV9wAsX26ofGb5wxn1N_nRrQ6s2lpp2I,4557
236
- accrete-0.0.97.dist-info/METADATA,sha256=obrYnpP2ESdIu5uE0B0Wp6gjlJtUwf4sy2QUGv7ZSN4,4952
237
- accrete-0.0.97.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
238
- accrete-0.0.97.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
239
- accrete-0.0.97.dist-info/RECORD,,
236
+ accrete-0.0.98.dist-info/METADATA,sha256=fCH0M8A4xpBgNS0cKIabZniRe1bCSLTdklUwVD6DwU0,4952
237
+ accrete-0.0.98.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
238
+ accrete-0.0.98.dist-info/licenses/LICENSE,sha256=_7laeMIHnsd3Y2vJEXDYXq_PEXxIcjgJsGt8UIKTRWc,1057
239
+ accrete-0.0.98.dist-info/RECORD,,