I upgraded my project to Django 6.1 thought to give the new on_delete=DB_CASCADE feature a try.
I ran into an issue with a ManyToManyField – it does not have an on_delete argument. When deleting a model instance that has a M2M field, I get a foreign key violation error.
I’m wondering if there are plans to add DB_CASCADE functionality to the ManyToManyField as well.
Can you show me an example failing case? I tried to follow your description, and I have a working example here:
Somewhat unexpected for me: I still got python delete collection on the through model. I’m not certain if we’re okay with that, or if we’d prefer to fire the system check that is meant to prevent mixing python/db delete variants in the relationship tree. The db deletes do work for the through table if you define it explicitly (shown commented out in the fiddle).