Answer the question
In order to leave comments, you need to log in
How to safely delete in Django?
Please tell me how to implement safe deletion in Django. It is necessary for me that it would not be possible to delete the object if there is at least one connection with another object. For example
Remove user.model.verbose_name?
Are you sure you want to delete user.model.verbose_name "[email protected]"? All of the following related objects will also be removed:
User.model.verbose_name: [email protected] Log
entry: Changed "[email protected]" - Changed password.
Log Entry: Changed "[email protected]" - Changed password.
Log Entry: Removed "[email protected]"
Log Entry: Removed "[email protected]"
Log Entry: Removed "[email protected]"
Log Entry: Removed "[email protected]"
Answer the question
In order to leave comments, you need to log in
See ForeignKey.on_delete , you need to put on_delete=models.PROTECT in the foreign key field.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question