QuerySet

Built-in QuerySet

class safedelete.queryset.SafeDeleteQueryset(model=None, query=None, using=None, hints=None)[source]

Default queryset for the SafeDeleteManager.

Takes care of “lazily evaluating” safedelete QuerySets. QuerySets passed within the SafeDeleteQueryset will have all of the models available. The deleted policy is evaluated at the very end of the chain when the QuerySet itself is evaluated.

delete(force_policy=None)[source]

Overrides bulk delete behaviour.

Note

The current implementation loses performance on bulk deletes in order to safely delete objects according to the deletion policies set.

undelete()[source]

Undelete all soft deleted models.

Note

The current implementation loses performance on bulk undeletes in order to call the pre/post-save signals.

all(force_visibility=None)[source]

Override so related managers can also see the deleted models.

A model’s m2m field does not easily have access to all_objects and so setting force_visibility to True is a way of getting all of the models. It is not recommended to use force_visibility outside of related models because it will create a new queryset.

Args:
force_visibility: Force a deletion visibility. (default: {None})