#26706: ManyToMany clear doesn't clear the items from the object but deletes
from
db
-------------------------------------+-------------------------------------
Reporter: cosmosgenius | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.8
(models, ORM) | Resolution:
Severity: Normal | worksforme
Keywords: manytomany, m2m, | Triage Stage:
clear | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):
* status: new => closed
* needs_better_patch: => 0
* resolution: => worksforme
* needs_tests: => 0
* needs_docs: => 0
Comment:
I can't reproduce that. Here's my complete test case:
{{{
from django.test import TestCase
from .models import Tag
class Test(TestCase):
def test(self):
tag = Tag.objects.create(tag='Tag')
tag.medias.create(name='A')
tag.medias.create(name='B')
tag.medias.create(name='C')
tag = Tag.objects.get(id=1)
tag.medias.clear()
print(tag.medias.all())
}}}
Also, Django's test suite
[https://github.com/django/django/blob/9c53facc45908bc0593de194a60bc75e5d34a48e/tests/many_to_many/tests.py#L507-L509
tests the behavior].
Please reopen if you can provide a failing test case.
--
Ticket URL: <https://code.djangoproject.com/ticket/26706#comment:1>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.6bb40f55ab49d4a3cf22442eaa3c6ceb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.