django-bulk-hooks 0.1.176__py3-none-any.whl → 0.1.177__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.

@@ -5,41 +5,8 @@ from django_bulk_hooks.queryset import HookQuerySet
5
5
 
6
6
  class BulkHookManager(models.Manager):
7
7
  def get_queryset(self):
8
- qs = HookQuerySet(self.model, using=self._db)
9
- return qs
10
-
11
- def bulk_update(
12
- self, objs, fields, bypass_hooks=False, bypass_validation=False, **kwargs
13
- ):
14
- """
15
- Delegate to QuerySet's bulk_update implementation.
16
- This follows Django's pattern where Manager methods call QuerySet methods.
17
- """
18
- import inspect
19
-
20
- qs = self.get_queryset()
21
-
22
- # Check if this is our HookQuerySet or a different QuerySet
23
- if (
24
- hasattr(qs, "bulk_update")
25
- and "bypass_hooks" in inspect.signature(qs.bulk_update).parameters
26
- ):
27
- # Our HookQuerySet - pass all parameters
28
- return qs.bulk_update(
29
- objs,
30
- fields,
31
- bypass_hooks=bypass_hooks,
32
- bypass_validation=bypass_validation,
33
- **kwargs,
34
- )
35
- else:
36
- # Different QuerySet (like queryable_properties) - only pass standard parameters
37
- django_kwargs = {
38
- k: v
39
- for k, v in kwargs.items()
40
- if k not in ["bypass_hooks", "bypass_validation"]
41
- }
42
- return qs.bulk_update(objs, fields, **django_kwargs)
8
+ queryset = HookQuerySet(self.model, using=self._db)
9
+ return queryset
43
10
 
44
11
  def bulk_create(
45
12
  self,
@@ -51,86 +18,58 @@ class BulkHookManager(models.Manager):
51
18
  unique_fields=None,
52
19
  bypass_hooks=False,
53
20
  bypass_validation=False,
21
+ **kwargs,
54
22
  ):
55
23
  """
56
24
  Delegate to QuerySet's bulk_create implementation.
57
25
  This follows Django's pattern where Manager methods call QuerySet methods.
58
26
  """
59
- import inspect
60
-
61
- queryset = self.get_queryset()
62
-
63
- # Check if this is our HookQuerySet or a different QuerySet
64
- if (
65
- hasattr(queryset, "bulk_create")
66
- and "bypass_hooks" in inspect.signature(queryset.bulk_create).parameters
67
- ):
68
- # Our HookQuerySet - pass all parameters
69
- kwargs = {
70
- "batch_size": batch_size,
71
- "ignore_conflicts": ignore_conflicts,
72
- "update_conflicts": update_conflicts,
73
- "update_fields": update_fields,
74
- "unique_fields": unique_fields,
75
- }
76
- return queryset.bulk_create(
77
- objs,
78
- bypass_hooks=bypass_hooks,
79
- bypass_validation=bypass_validation,
80
- **kwargs,
81
- )
82
- else:
83
- print("Different QuerySet")
84
-
85
- # Different QuerySet - only pass standard parameters
86
- kwargs = {
87
- "batch_size": batch_size,
88
- "ignore_conflicts": ignore_conflicts,
89
- "update_conflicts": update_conflicts,
90
- "update_fields": update_fields,
91
- "unique_fields": unique_fields,
92
- }
93
- return queryset.bulk_create(objs, **kwargs)
27
+ return self.get_queryset().bulk_create(
28
+ objs,
29
+ bypass_hooks=bypass_hooks,
30
+ bypass_validation=bypass_validation,
31
+ batch_size=batch_size,
32
+ ignore_conflicts=ignore_conflicts,
33
+ update_conflicts=update_conflicts,
34
+ update_fields=update_fields,
35
+ unique_fields=unique_fields,
36
+ **kwargs,
37
+ )
94
38
 
95
- def bulk_delete(
96
- self, objs, batch_size=None, bypass_hooks=False, bypass_validation=False
39
+ def bulk_update(
40
+ self, objs, fields, bypass_hooks=False, bypass_validation=False, **kwargs
97
41
  ):
98
42
  """
99
- Delegate to QuerySet's bulk_delete implementation.
43
+ Delegate to QuerySet's bulk_update implementation.
100
44
  This follows Django's pattern where Manager methods call QuerySet methods.
101
45
  """
102
- import inspect
46
+ return self.get_queryset().bulk_update(
47
+ objs,
48
+ fields,
49
+ bypass_hooks=bypass_hooks,
50
+ bypass_validation=bypass_validation,
51
+ **kwargs,
52
+ )
103
53
 
104
- qs = self.get_queryset()
105
-
106
- # Check if this is our HookQuerySet or a different QuerySet
107
- if (
108
- hasattr(qs, "bulk_delete")
109
- and "bypass_hooks" in inspect.signature(qs.bulk_delete).parameters
110
- ):
111
- # Our HookQuerySet - pass all parameters
112
- kwargs = {
113
- "batch_size": batch_size,
114
- }
115
- return qs.bulk_delete(
116
- objs,
117
- bypass_hooks=bypass_hooks,
118
- bypass_validation=bypass_validation,
119
- **kwargs,
120
- )
121
- else:
122
- # Different QuerySet - only pass standard parameters
123
- kwargs = {
124
- "batch_size": batch_size,
125
- }
126
- return qs.bulk_delete(objs, **kwargs)
127
-
128
- def update(self, **kwargs):
54
+ def bulk_delete(
55
+ self,
56
+ objs,
57
+ batch_size=None,
58
+ bypass_hooks=False,
59
+ bypass_validation=False,
60
+ **kwargs,
61
+ ):
129
62
  """
130
- Delegate to QuerySet's update implementation.
63
+ Delegate to QuerySet's bulk_delete implementation.
131
64
  This follows Django's pattern where Manager methods call QuerySet methods.
132
65
  """
133
- return self.get_queryset().update(**kwargs)
66
+ return self.get_queryset().bulk_delete(
67
+ objs,
68
+ bypass_hooks=bypass_hooks,
69
+ bypass_validation=bypass_validation,
70
+ batch_size=batch_size,
71
+ **kwargs,
72
+ )
134
73
 
135
74
  def delete(self):
136
75
  """
@@ -139,6 +78,13 @@ class BulkHookManager(models.Manager):
139
78
  """
140
79
  return self.get_queryset().delete()
141
80
 
81
+ def update(self, **kwargs):
82
+ """
83
+ Delegate to QuerySet's update implementation.
84
+ This follows Django's pattern where Manager methods call QuerySet methods.
85
+ """
86
+ return self.get_queryset().update(**kwargs)
87
+
142
88
  def save(self, obj):
143
89
  """
144
90
  Save a single object using the appropriate bulk operation.
@@ -302,6 +302,10 @@ class HookQuerySet(models.QuerySet):
302
302
  if inheritance_chain is None:
303
303
  inheritance_chain = self._get_inheritance_chain()
304
304
 
305
+ for inheritance in inheritance_chain:
306
+ print(inheritance)
307
+
308
+
305
309
  # Safety check to prevent infinite recursion
306
310
  if len(inheritance_chain) > 10: # Arbitrary limit to prevent infinite loops
307
311
  raise ValueError(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.176
3
+ Version: 0.1.177
4
4
  Summary: Hook-style hooks for Django bulk operations like bulk_create and bulk_update.
5
5
  License: MIT
6
6
  Keywords: django,bulk,hooks
@@ -6,12 +6,12 @@ django_bulk_hooks/decorators.py,sha256=WD7Jn7QAvY8F4wOsYlIpjoM9-FdHXSKB7hH9ot-lk
6
6
  django_bulk_hooks/engine.py,sha256=nA5PU9msk_Ju5Gf_sTd7GqPscuTxEW5itCDAoSScYGI,1645
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=y0z-tnIZx60DlYPRyVdVbaR6IXeJzCQLE0m8IB6Igjw,5158
9
+ django_bulk_hooks/manager.py,sha256=KLEjpQRt4WlzgBAf_X3XOAPUQM8Jmc1fIt8yr62FPQc,3044
10
10
  django_bulk_hooks/models.py,sha256=7fnx5xd4HWXfLVlFhhiRzR92JRWFEuxgk6aSWLEsyJg,3996
11
11
  django_bulk_hooks/priority.py,sha256=HG_2D35nga68lBCZmSXTcplXrjFoRgZFRDOy4ROKonY,376
12
- django_bulk_hooks/queryset.py,sha256=Ii-5nXKUhN070LRWTjJNUjynWdtKDzRW7MuT3c6KQAw,22179
12
+ django_bulk_hooks/queryset.py,sha256=unW-YBkiS5NbuPwOdbRK05ZOKRi7KjSxevyKX22NxmU,22270
13
13
  django_bulk_hooks/registry.py,sha256=-mQBizJ06nz_tajZBinViKx_uP2Tbc1tIpTEMv7lwKA,705
14
- django_bulk_hooks-0.1.176.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
- django_bulk_hooks-0.1.176.dist-info/METADATA,sha256=4t1fn4kW8CbHXjWVQcUbU_pAQ3SyT-MwCrsh5b0-19o,6951
16
- django_bulk_hooks-0.1.176.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
- django_bulk_hooks-0.1.176.dist-info/RECORD,,
14
+ django_bulk_hooks-0.1.177.dist-info/LICENSE,sha256=dguKIcbDGeZD-vXWdLyErPUALYOvtX_fO4Zjhq481uk,1088
15
+ django_bulk_hooks-0.1.177.dist-info/METADATA,sha256=99nhQDIQt5uMqZedTPGw7wB1VLpkE0VacnVeyk2koiM,6951
16
+ django_bulk_hooks-0.1.177.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
17
+ django_bulk_hooks-0.1.177.dist-info/RECORD,,