Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to query all deleted items and how to deleted specific one #80

Open
AlenSci opened this issue Jul 7, 2021 · 2 comments
Open

How to query all deleted items and how to deleted specific one #80

AlenSci opened this issue Jul 7, 2021 · 2 comments

Comments

@AlenSci
Copy link

AlenSci commented Jul 7, 2021

the documentations here are not clear about how to use the undelte and queryset.

from safedelete.queryset import SafeDeleteQueryset


event = Event.objects.create(created_by=self.user, title='event',end=self.after_1_d)
event.delete()
icprintEvent.objects.count())
# should I get the object by id or smthing? print(SafeDeleteQueryset.undelete(query={"id":event.id}))
# should I do SafeDeleteQueryset.all()
# print(Event.objects.count())
@HT-Moh
Copy link

HT-Moh commented Sep 3, 2021

You can a delete a record completely
SoftDeleteRecord.objects.filter(id=5).delete()
You can do hard delete for all records
SoftDeleteRecord.objects.filter(id__isnull=False).delete()
You can query the deleted records for specific table using the content type like this SoftDeleteRecord.objects.filter(content_type__model="Event")
Delete the change set
ChangeSet.objects.filter().delete()

@gmverdon
Copy link

gmverdon commented Jun 7, 2023

Item.objects.all_with_deleted()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants