Ticket #24505: issue24505_testcase.diff

File issue24505_testcase.diff, 1013 bytes (added by Baptiste Mispelon, 10 years ago)

Reproduction testcase

  • new file tests/issue24505/models.py

    diff --git a/tests/issue24505/__init__.py b/tests/issue24505/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/issue24505/models.py b/tests/issue24505/models.py
    new file mode 100644
    index 0000000..49aa276
    - +  
     1from django.db import models
     2
     3class Foo(models.Model):
     4    def __str__(self):
     5        return str(self.pk)
     6
     7
     8class Bar(models.Model):
     9    foos1 = models.ManyToManyField(Foo, related_name='+')
     10    foos2 = models.ManyToManyField(Foo, related_name='+')
  • new file tests/issue24505/tests.py

    diff --git a/tests/issue24505/tests.py b/tests/issue24505/tests.py
    new file mode 100644
    index 0000000..0dace0a
    - +  
     1from django.test import TestCase
     2
     3from .models import Foo, Bar
     4
     5class ReproTestCase(TestCase):
     6    def test_24505(self):
     7        f = Foo.objects.create()
     8        b = Bar.objects.create()
     9
     10        b.foos1.add(f)
     11
     12        self.assertQuerysetEqual(b.foos1.all(), ['<Foo: 1>'])
Back to Top