Skip to content

Commit

Permalink
carry forward force_policy to the Queryset (#74)
Browse files Browse the repository at this point in the history
* carry forward force_policy to the Queryset

force_policy feature is currently only available on the model instances.  Enable this feature for SafeDeleteQuerySet as well.

* Carry forward force_policy to the Queryset 

force_policy feature is currently only available on the model instances. Enable this feature for SafeDeleteQuerySet as well.

* Update CHANGES
  • Loading branch information
Steve Jones authored and Gagaro committed Apr 4, 2017
1 parent 139a027 commit 8173705
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -9,6 +9,7 @@ CHANGELOG

- Filtering on the deleted field is done on evaluation.
- Added specific managers: all_objects and deleted_objects.
- Added 'force_policy' feature to SafeDeleteQuerySet.

** Removed **

Expand Down
4 changes: 2 additions & 2 deletions safedelete/queryset.py
Expand Up @@ -14,7 +14,7 @@ class SafeDeleteQueryset(query.QuerySet):
QuerySet itself is evaluated.
"""

def delete(self):
def delete(self, force_policy=None):
"""Overrides bulk delete behaviour.
.. note::
Expand All @@ -27,7 +27,7 @@ def delete(self):
assert self.query.can_filter(), "Cannot use 'limit' or 'offset' with delete."
# TODO: Replace this by bulk update if we can
for obj in self.all():
obj.delete()
obj.delete(force_policy=force_policy)
self._result_cache = None
delete.alters_data = True

Expand Down

0 comments on commit 8173705

Please sign in to comment.