guettli
guettli

Reputation: 27806

Suppress warning about on_delete=CASCADE in Django Admin

I have some foreign keys to auth-User with on_delete=CASCADE.

If someone deletes a user, Django displays this warning.

django-admin-delete

Is there a way to avoid this warning?

It would be great if I could avoid it for every ForeignKey indiviually.

Upvotes: 1

Views: 305

Answers (1)

iri
iri

Reputation: 744

If you want to avoid it for every foreign key the easiest way would be to overwrite the default django/contrib/admin/templates/admin/delete_confirmation.html template by adding a custom delete_confirmation.html template in your own project structure, there is documentation on doing this here.

Upvotes: 1

Related Questions