django-safedelete icon indicating copy to clipboard operation
django-safedelete copied to clipboard

_safedelete_visibility hide deleted object completely

Open anuj9196 opened this issue 6 years ago • 3 comments

There are two visibility mode as per the documentation set to _safedelete_visibility

DELETED_INVISIBLE and DELETED_VISIBLE_BY_PK

But returns data either in the queryset or when accessed by the pk.

Is there a way to completely hide the object from queryset and even can't be accessed by the pk.

I want the objects to be deleted by the user, and the user should not be able to see it again in any means. Only admin user can access the deleted object from the admin panel.

Or any way to filter the queryset to exclude the deleted objects even from the related objects.

anuj9196 avatar Jun 27 '19 14:06 anuj9196

Do you perhaps know how to import DELETED_INVISIBLE and DELETED_VISIBLE_BY_PK? (sorry, I know this doesn't answer your question)

HeinrichWizardKreuser avatar Jun 29 '19 08:06 HeinrichWizardKreuser

@HeinrichWizardKreuser please don't post the same question in multiple issues. #123

AndreasBackx avatar Jun 29 '19 12:06 AndreasBackx

@anuj9196 could you provide some code and perhaps a test case in a PR to illustrate your point/bug?

There are two visibility mode as per the documentation set to _safedelete_visibility DELETED_INVISIBLE and DELETED_VISIBLE_BY_PK But returns data either in the queryset or when accessed by the pk.

DELETED_INVISIBLE does not show soft deleted items in the database unless it's a related field. See the docs. Unless you found a bug, if so, please provide some more info.

Is there a way to completely hide the object from queryset and even can't be accessed by the pk.

DELETED_INVISIBLE should, see above and docs.

I want the objects to be deleted by the user, and the user should not be able to see it again in any means. Only admin user can access the deleted object from the admin panel.

Or any way to filter the queryset to exclude the deleted objects even from the related objects.

Perhaps you can override the queryset in the Django admin panel to use SafeDeleteModel.all_objects.

AndreasBackx avatar Jun 29 '19 12:06 AndreasBackx