diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/fixtures_regress/fixtures/special-article.json | 10 | ||||
| -rw-r--r-- | tests/fixtures_regress/models.py | 5 | ||||
| -rw-r--r-- | tests/fixtures_regress/tests.py | 11 |
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/fixtures_regress/fixtures/special-article.json b/tests/fixtures_regress/fixtures/special-article.json new file mode 100644 index 0000000000..435ceb7ca4 --- /dev/null +++ b/tests/fixtures_regress/fixtures/special-article.json @@ -0,0 +1,10 @@ +[ + { + "pk": 1, + "model": "fixtures_regress.specialarticle", + "fields": { + "title": "Article Title 1", + "channels": [] + } + } +] diff --git a/tests/fixtures_regress/models.py b/tests/fixtures_regress/models.py index 99096728a7..ab4fb8750c 100644 --- a/tests/fixtures_regress/models.py +++ b/tests/fixtures_regress/models.py @@ -70,6 +70,11 @@ class Article(models.Model): ordering = ('id',) +# Subclass of a model with a ManyToManyField for test_ticket_20820 +class SpecialArticle(Article): + pass + + # Models to regression test #11428 @python_2_unicode_compatible class Widget(models.Model): diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py index f917b21642..e2985d3350 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -444,6 +444,17 @@ class TestFixtures(TestCase): self.assertTrue("No fixture 'this_fixture_doesnt_exist' in" in force_text(stdout_output.getvalue())) + def test_ticket_20820(self): + """ + Regression for ticket #20820 -- loaddata on a model that inherits + from a model with a M2M shouldn't blow up. + """ + management.call_command( + 'loaddata', + 'special-article.json', + verbosity=0, + ) + class NaturalKeyFixtureTests(TestCase): |
