About the Delete Admin Action
The delete()
method of a model is not called when you trigger the "delete" admin action. The records are deleted at the QuerySet level.
When you need to do some pre- or post-processing for each model instance with the "delete" admin action, you can overwrite the delete_queryset()
method of the model admin:
admin.py
1 2 3 4 5 |
|
models.py
1 2 3 4 |
|
Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.