django-bulk-hooks 0.1.116__py3-none-any.whl → 0.1.117__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.
Potentially problematic release.
This version of django-bulk-hooks might be problematic. Click here for more details.
- django_bulk_hooks/manager.py +6 -14
- {django_bulk_hooks-0.1.116.dist-info → django_bulk_hooks-0.1.117.dist-info}/METADATA +1 -1
- {django_bulk_hooks-0.1.116.dist-info → django_bulk_hooks-0.1.117.dist-info}/RECORD +5 -5
- {django_bulk_hooks-0.1.116.dist-info → django_bulk_hooks-0.1.117.dist-info}/LICENSE +0 -0
- {django_bulk_hooks-0.1.116.dist-info → django_bulk_hooks-0.1.117.dist-info}/WHEEL +0 -0
django_bulk_hooks/manager.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
from django.db import models, transaction
|
|
4
2
|
from django.db.models import AutoField
|
|
5
3
|
|
|
@@ -22,12 +20,9 @@ from django_bulk_hooks.queryset import HookQuerySet
|
|
|
22
20
|
class BulkHookManager(models.Manager):
|
|
23
21
|
CHUNK_SIZE = 200
|
|
24
22
|
|
|
25
|
-
|
|
26
23
|
def get_queryset(self):
|
|
27
24
|
return HookQuerySet(self.model, using=self._db)
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
26
|
@transaction.atomic
|
|
32
27
|
def bulk_update(
|
|
33
28
|
self, objs, fields, bypass_hooks=False, bypass_validation=False, **kwargs
|
|
@@ -77,8 +72,6 @@ class BulkHookManager(models.Manager):
|
|
|
77
72
|
|
|
78
73
|
return objs
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
|
|
82
75
|
@transaction.atomic
|
|
83
76
|
def bulk_create(
|
|
84
77
|
self,
|
|
@@ -154,11 +147,6 @@ class BulkHookManager(models.Manager):
|
|
|
154
147
|
|
|
155
148
|
return result
|
|
156
149
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
150
|
# --- Private helper methods (moved to bottom for clarity) ---
|
|
163
151
|
|
|
164
152
|
def _detect_modified_fields(self, new_instances, original_instances):
|
|
@@ -329,12 +317,16 @@ class BulkHookManager(models.Manager):
|
|
|
329
317
|
Set auto_now_add and auto_now fields on objects before bulk_create.
|
|
330
318
|
"""
|
|
331
319
|
from django.utils import timezone
|
|
320
|
+
|
|
332
321
|
now = timezone.now()
|
|
333
322
|
for obj in objs:
|
|
334
323
|
for field in model._meta.local_fields:
|
|
335
|
-
if
|
|
324
|
+
if (
|
|
325
|
+
getattr(field, "auto_now_add", False)
|
|
326
|
+
and getattr(obj, field.name, None) is None
|
|
327
|
+
):
|
|
336
328
|
setattr(obj, field.name, now)
|
|
337
|
-
if getattr(field,
|
|
329
|
+
if getattr(field, "auto_now", False):
|
|
338
330
|
setattr(obj, field.name, now)
|
|
339
331
|
|
|
340
332
|
@transaction.atomic
|
|
@@ -6,12 +6,12 @@ django_bulk_hooks/decorators.py,sha256=tckDcxtOzKCbgvS9QydgeIAWTFDEl-ch3_Q--ruEG
|
|
|
6
6
|
django_bulk_hooks/engine.py,sha256=3HbgV12JRYIy9IlygHPxZiHnFXj7EwzLyTuJNQeVIoI,1402
|
|
7
7
|
django_bulk_hooks/enums.py,sha256=Zo8_tJzuzZ2IKfVc7gZ-0tWPT8q1QhqZbAyoh9ZVJbs,381
|
|
8
8
|
django_bulk_hooks/handler.py,sha256=xZt8iNdYF-ACz-MnKMY0co6scWINU5V5wC1lyDn844k,4854
|
|
9
|
-
django_bulk_hooks/manager.py,sha256=
|
|
9
|
+
django_bulk_hooks/manager.py,sha256=3WtqgKBqL8uWkOeGnw0xPp3AGpaxJSbT63ltgDxb2fU,15747
|
|
10
10
|
django_bulk_hooks/models.py,sha256=7RG7GrOdHXFjGVPV4FPRZVNMIHHW-hMCi6hn9LH_hVI,3331
|
|
11
11
|
django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
|
|
12
12
|
django_bulk_hooks/queryset.py,sha256=iet4z-9SKhnresA4FBQbxx9rdYnoaOWbw9LUlGftlP0,1466
|
|
13
13
|
django_bulk_hooks/registry.py,sha256=-mQBizJ06nz_tajZBinViKx_uP2Tbc1tIpTEMv7lwKA,705
|
|
14
|
-
django_bulk_hooks-0.1.
|
|
15
|
-
django_bulk_hooks-0.1.
|
|
16
|
-
django_bulk_hooks-0.1.
|
|
17
|
-
django_bulk_hooks-0.1.
|
|
14
|
+
django_bulk_hooks-0.1.117.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
|
|
15
|
+
django_bulk_hooks-0.1.117.dist-info/METADATA,sha256=b1mTw0rJZLbei3sm2bN480iVoU5KzXOs6D-_qyeVcrQ,6939
|
|
16
|
+
django_bulk_hooks-0.1.117.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
17
|
+
django_bulk_hooks-0.1.117.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|