django-bulk-hooks 0.1.280__tar.gz → 0.1.281__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.280 → django_bulk_hooks-0.1.281}/PKG-INFO +1 -1
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/queryset.py +32 -2
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/pyproject.toml +1 -1
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/LICENSE +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/README.md +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/__init__.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/conditions.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/constants.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/context.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/decorators.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/engine.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/enums.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/handler.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/manager.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/models.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/priority.py +0 -0
- {django_bulk_hooks-0.1.280 → django_bulk_hooks-0.1.281}/django_bulk_hooks/registry.py +0 -0
|
@@ -1899,7 +1899,22 @@ class HookQuerySetMixin:
|
|
|
1899
1899
|
if hasattr(source_obj, field.name):
|
|
1900
1900
|
value = getattr(source_obj, field.name, None)
|
|
1901
1901
|
if value is not None:
|
|
1902
|
-
|
|
1902
|
+
# Handle foreign key fields properly
|
|
1903
|
+
if (
|
|
1904
|
+
field.is_relation
|
|
1905
|
+
and not field.many_to_many
|
|
1906
|
+
and not field.one_to_many
|
|
1907
|
+
):
|
|
1908
|
+
# For foreign key fields, extract the ID if we have a model instance
|
|
1909
|
+
if hasattr(value, "pk") and value.pk is not None:
|
|
1910
|
+
# Set the foreign key ID field (e.g., loan_account_id)
|
|
1911
|
+
setattr(parent_obj, field.attname, value.pk)
|
|
1912
|
+
else:
|
|
1913
|
+
# If it's already an ID or None, use it as-is
|
|
1914
|
+
setattr(parent_obj, field.attname, value)
|
|
1915
|
+
else:
|
|
1916
|
+
# For non-relation fields, copy the value directly
|
|
1917
|
+
setattr(parent_obj, field.name, value)
|
|
1903
1918
|
if current_parent is not None:
|
|
1904
1919
|
for field in parent_model._meta.local_fields:
|
|
1905
1920
|
if (
|
|
@@ -1932,7 +1947,22 @@ class HookQuerySetMixin:
|
|
|
1932
1947
|
if hasattr(source_obj, field.name):
|
|
1933
1948
|
value = getattr(source_obj, field.name, None)
|
|
1934
1949
|
if value is not None:
|
|
1935
|
-
|
|
1950
|
+
# Handle foreign key fields properly
|
|
1951
|
+
if (
|
|
1952
|
+
field.is_relation
|
|
1953
|
+
and not field.many_to_many
|
|
1954
|
+
and not field.one_to_many
|
|
1955
|
+
):
|
|
1956
|
+
# For foreign key fields, extract the ID if we have a model instance
|
|
1957
|
+
if hasattr(value, "pk") and value.pk is not None:
|
|
1958
|
+
# Set the foreign key ID field (e.g., loan_account_id)
|
|
1959
|
+
setattr(child_obj, field.attname, value.pk)
|
|
1960
|
+
else:
|
|
1961
|
+
# If it's already an ID or None, use it as-is
|
|
1962
|
+
setattr(child_obj, field.attname, value)
|
|
1963
|
+
else:
|
|
1964
|
+
# For non-relation fields, copy the value directly
|
|
1965
|
+
setattr(child_obj, field.name, value)
|
|
1936
1966
|
|
|
1937
1967
|
# Set parent links for MTI
|
|
1938
1968
|
for parent_model, parent_instance in parent_instances.items():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "django-bulk-hooks"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.281"
|
|
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
|