1👍
delete selected is a bulk action and for efficiency reasons Django deletes the whole queryset at once, not calling the delete()
method on each model instance.
If you need to make sure it does get called, e.g. you have some custom handling there that should not be skipped, just override the delete_queryset
method on your ModelAdmin subclass like this:
# content of admin.py in your Django app
from django.contrib import admin
class MyModelAdmin(admin.ModelAdmin):
def delete_queryset(self, request, queryset):
for obj in queryset.all():
obj.delete()
- [Answered ]-Why does this Django filter query return empty list?
- [Answered ]-How to change value of the field in a proxy model in Django
- [Answered ]-Unable to to access Generic Views with JWT authentication
Source:stackexchange.com