Bobosher Musurmonov
unread,Feb 7, 2022, 9:11:41 AM2/7/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Hello, I have overloaded delete() method of my model to enable soft deletion so that delete() method just sets is_seleted field to be True.
When calling this method for individual objects, it works fine.
But when I called delete() method directly for a queryset (for example, MyModel.objects.filter(id__lte=10).delete(), it just hard-deleted those objects and not called my custom delete() method.
Please, let me know if it's a bug or not.
If it isn't, please let me know how to do this in a better way.
Now, my temporary solution is iterating through selected objects and call delete() method for each.
I've tested this on 2 versions of django: 1.11 and 3.2