S
S
sazhyk2016-12-09 17:36:35
Django
sazhyk, 2016-12-09 17:36:35

How to remove the delete() method of a Django model?

How to delete or, failing that, override the delete() method of a model?
There is a need to prohibit the possibility of deleting objects. Perhaps there are other ways to prevent such actions. But, it is highly desirable that even superuser cannot delete an entry from the database using the web interface. I don’t consider the case of a direct request to the database, because if an attacker got direct access to the database, then the problems are much more serious.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Kitaev, 2016-12-09
@deliro

Don't be bullshit. It is necessary to eliminate the causes, not the consequences.

V
Vladimir, 2016-12-10
@vintello

I agree with Roman Kitaev . but if you really want to .....
on the model you need to override the delete method . to add such an opportunity to the user, use default permissions
for everyone, prohibit deletion and issue only to those who are in the admin group or trusted users

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question