summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2013-08-20 16:23:25 +0300
committerAndrew Godwin <andrew@aeracode.org>2013-08-21 22:31:50 +0100
commitf5552571dc7a0d9da9df1d108bc4bbef6857c157 (patch)
tree7d4eabe2968284e8f7f4f332ede2c26db8b3708d /tests
parentced3e6b17d18174216cdbe1ec7c24cc1819db787 (diff)
Fixed #20820 -- Model inheritance + m2m fixture loading regression
Tests by Tim Graham, report from jeroen.pulles@redslider.net.
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures_regress/fixtures/special-article.json10
-rw-r--r--tests/fixtures_regress/models.py5
-rw-r--r--tests/fixtures_regress/tests.py11
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):