django-bulk-hooks 0.1.192__tar.gz → 0.1.193__tar.gz
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-0.1.192 → django_bulk_hooks-0.1.193}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/queryset.py +19 -1
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/LICENSE +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/README.md +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.192 → django_bulk_hooks-0.1.193}/django_bulk_hooks/registry.py +0 -0
|
@@ -14,7 +14,7 @@ from django_bulk_hooks.constants import (
|
|
|
14
14
|
VALIDATE_UPDATE,
|
|
15
15
|
)
|
|
16
16
|
from django_bulk_hooks.context import HookContext
|
|
17
|
-
from django.db.models import When, Value, Case
|
|
17
|
+
from django.db.models import When, Value, Case, Field
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class HookQuerySetMixin:
|
|
@@ -226,6 +226,18 @@ class HookQuerySetMixin:
|
|
|
226
226
|
fields_set.update(modified_fields)
|
|
227
227
|
fields = list(fields_set)
|
|
228
228
|
|
|
229
|
+
# Handle auto_now fields like Django's update_or_create does
|
|
230
|
+
fields_set = set(fields)
|
|
231
|
+
pk_fields = model_cls._meta.pk_fields
|
|
232
|
+
for field in model_cls._meta.local_concrete_fields:
|
|
233
|
+
if not (
|
|
234
|
+
field in pk_fields or field.__class__.pre_save is Field.pre_save
|
|
235
|
+
):
|
|
236
|
+
fields_set.add(field.name)
|
|
237
|
+
if field.name != field.attname:
|
|
238
|
+
fields_set.add(field.attname)
|
|
239
|
+
fields = list(fields_set)
|
|
240
|
+
|
|
229
241
|
# Handle MTI models differently
|
|
230
242
|
if is_mti:
|
|
231
243
|
result = self._mti_bulk_update(objs, fields, **kwargs)
|
|
@@ -557,6 +569,12 @@ class HookQuerySetMixin:
|
|
|
557
569
|
"Inheritance chain too deep - possible infinite recursion detected"
|
|
558
570
|
)
|
|
559
571
|
|
|
572
|
+
# Handle auto_now fields by calling pre_save on objects
|
|
573
|
+
for obj in objs:
|
|
574
|
+
for field in model_cls._meta.local_fields:
|
|
575
|
+
if hasattr(field, "auto_now") and field.auto_now:
|
|
576
|
+
field.pre_save(obj, add=False)
|
|
577
|
+
|
|
560
578
|
# Group fields by model in the inheritance chain
|
|
561
579
|
field_groups = {}
|
|
562
580
|
for field_name in fields:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django-bulk-hooks"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.193"
|
|
4
4
|
description = "Hook-style hooks for Django bulk operations like bulk_create and bulk_update."
|
|
5
5
|
authors = ["Konrad Beck <konrad.beck@merchantcapital.co.za>"]
|
|
6
6
|
readme = "README.md"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|