django-bulk-hooks 0.1.62__tar.gz → 0.1.63__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.

Files changed (17) hide show
  1. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/PKG-INFO +1 -1
  2. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/conditions.py +45 -5
  3. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/pyproject.toml +1 -1
  4. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/LICENSE +0 -0
  5. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/README.md +0 -0
  6. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/__init__.py +0 -0
  7. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/constants.py +0 -0
  8. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/context.py +0 -0
  9. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/decorators.py +0 -0
  10. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/engine.py +0 -0
  11. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/enums.py +0 -0
  12. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/handler.py +0 -0
  13. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/manager.py +0 -0
  14. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/models.py +0 -0
  15. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/priority.py +0 -0
  16. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/queryset.py +0 -0
  17. {django_bulk_hooks-0.1.62 → django_bulk_hooks-0.1.63}/django_bulk_hooks/registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.1.62
3
+ Version: 0.1.63
4
4
  Summary: Lifecycle-style hooks for Django bulk operations like bulk_create and bulk_update.
5
5
  License: MIT
6
6
  Keywords: django,bulk,hooks
@@ -31,7 +31,7 @@ class HookCondition:
31
31
  return NotCondition(self)
32
32
 
33
33
 
34
- class WhenFieldValueIsNot(HookCondition):
34
+ class IsNotEqual(HookCondition):
35
35
  def __init__(self, field, value, only_on_change=False):
36
36
  self.field = field
37
37
  self.value = value
@@ -54,7 +54,7 @@ class WhenFieldValueIsNot(HookCondition):
54
54
  return current != self.value
55
55
 
56
56
 
57
- class WhenFieldValueIs(HookCondition):
57
+ class IsEqual(HookCondition):
58
58
  def __init__(self, field, value, only_on_change=False):
59
59
  self.field = field
60
60
  self.value = value
@@ -77,7 +77,7 @@ class WhenFieldValueIs(HookCondition):
77
77
  return current == self.value
78
78
 
79
79
 
80
- class WhenFieldHasChanged(HookCondition):
80
+ class HasChanged(HookCondition):
81
81
  def __init__(self, field, has_changed=True):
82
82
  self.field = field
83
83
  self.has_changed = has_changed
@@ -90,7 +90,7 @@ class WhenFieldHasChanged(HookCondition):
90
90
  return (current != previous) == self.has_changed
91
91
 
92
92
 
93
- class WhenFieldValueWas(HookCondition):
93
+ class WasEqual(HookCondition):
94
94
  def __init__(self, field, value, only_on_change=False):
95
95
  """
96
96
  Check if a field's original value was `value`.
@@ -111,7 +111,7 @@ class WhenFieldValueWas(HookCondition):
111
111
  return previous == self.value
112
112
 
113
113
 
114
- class WhenFieldValueChangesTo(HookCondition):
114
+ class ChangesTo(HookCondition):
115
115
  def __init__(self, field, value):
116
116
  """
117
117
  Check if a field's value has changed to `value`.
@@ -128,6 +128,46 @@ class WhenFieldValueChangesTo(HookCondition):
128
128
  return previous != self.value and current == self.value
129
129
 
130
130
 
131
+ class IsGreaterThan(HookCondition):
132
+ def __init__(self, field, value):
133
+ self.field = field
134
+ self.value = value
135
+
136
+ def check(self, instance, original_instance=None):
137
+ current = resolve_dotted_attr(instance, self.field)
138
+ return current is not None and current > self.value
139
+
140
+
141
+ class IsGreaterThanOrEqual(HookCondition):
142
+ def __init__(self, field, value):
143
+ self.field = field
144
+ self.value = value
145
+
146
+ def check(self, instance, original_instance=None):
147
+ current = resolve_dotted_attr(instance, self.field)
148
+ return current is not None and current >= self.value
149
+
150
+
151
+ class IsLessThan(HookCondition):
152
+ def __init__(self, field, value):
153
+ self.field = field
154
+ self.value = value
155
+
156
+ def check(self, instance, original_instance=None):
157
+ current = resolve_dotted_attr(instance, self.field)
158
+ return current is not None and current < self.value
159
+
160
+
161
+ class IsLessThanOrEqual(HookCondition):
162
+ def __init__(self, field, value):
163
+ self.field = field
164
+ self.value = value
165
+
166
+ def check(self, instance, original_instance=None):
167
+ current = resolve_dotted_attr(instance, self.field)
168
+ return current is not None and current <= self.value
169
+
170
+
131
171
  class AndCondition(HookCondition):
132
172
  def __init__(self, cond1, cond2):
133
173
  self.cond1 = cond1
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "django-bulk-hooks"
3
- version = "0.1.62"
3
+ version = "0.1.63"
4
4
  description = "Lifecycle-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"