#27585: ManyToMany relationship is cascading delete after being detached -------------------------------------+------------------------------------- Reporter: Teresa | Owner: nobody Type: Bug | Status: closed Component: Database layer | Version: 1.8 (models, ORM) | Severity: Normal | Resolution: invalid Keywords: ManyToMany, | Triage Stage: cascade, delete, remove | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Matt): This problem just happened to me on Django 2.2.12 in a migration. e.g. {{{ Category = apps.get_model('blog', 'Category') cat = Category.objects.filter(name='Cat A').first() for article in list(cat.article_set.all()): cat.article_set.remove(article) # This deleted all articles that were in the category but were already removed() cat.delete() }}} -- Ticket URL: <https://code.djangoproject.com/ticket/27585#comment:5> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.3166137b991cb0e66b63feaf1d66ca66%40djangoproject.com.