summaryrefslogtreecommitdiff
path: root/tests/fixtures_regress
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2014-05-12 13:46:47 -0300
committerRamiro Morales <cramm0@gmail.com>2014-05-17 17:36:45 -0300
commit862e1ff2340a1e28a3e7c6904d2b0283085f34c8 (patch)
tree4b575b6eb0fc68426efd754c1585c805c777ff62 /tests/fixtures_regress
parente520a73eeea6b185b719901ab9985ecef00e5664 (diff)
downloaddjango-862e1ff2340a1e28a3e7c6904d2b0283085f34c8.tar.gz
Fixed #22421 -- Regression in fixtures loading.
Loading fixtures were failing since the refactoring in 244e2b71f5 for inheritance setups where the chain contains abstract models and the root ancestor contains a M2M relation. Thanks Stanislas Guerra for the report. Refs #20946.
Diffstat (limited to 'tests/fixtures_regress')
-rw-r--r--tests/fixtures_regress/fixtures/feature.json17
-rw-r--r--tests/fixtures_regress/models.py13
-rw-r--r--tests/fixtures_regress/tests.py12
3 files changed, 41 insertions, 1 deletions
diff --git a/tests/fixtures_regress/fixtures/feature.json b/tests/fixtures_regress/fixtures/feature.json
new file mode 100644
index 0000000000..84aa2adcf4
--- /dev/null
+++ b/tests/fixtures_regress/fixtures/feature.json
@@ -0,0 +1,17 @@
+[
+{
+ "fields": {
+ "channels": [],
+ "title": "Title of this feature article"
+ },
+ "model": "fixtures_regress.article",
+ "pk": 1
+},
+{
+ "fields": {
+ "channels": []
+ },
+ "model": "fixtures_regress.feature",
+ "pk": 1
+}
+]
diff --git a/tests/fixtures_regress/models.py b/tests/fixtures_regress/models.py
index b9a1bb7fc1..f75b1e02d0 100644
--- a/tests/fixtures_regress/models.py
+++ b/tests/fixtures_regress/models.py
@@ -52,7 +52,7 @@ class Child(Parent):
data = models.CharField(max_length=10)
-# Models to regression test #7572
+# Models to regression test #7572, #20820
class Channel(models.Model):
name = models.CharField(max_length=255)
@@ -70,6 +70,17 @@ class SpecialArticle(Article):
pass
+# Models to regression test #22421
+class CommonFeature(Article):
+
+ class Meta:
+ abstract = True
+
+
+class Feature(CommonFeature):
+ 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 613cb898c5..a9d3ae170b 100644
--- a/tests/fixtures_regress/tests.py
+++ b/tests/fixtures_regress/tests.py
@@ -486,6 +486,18 @@ class TestFixtures(TestCase):
verbosity=0,
)
+ def test_ticket_22421(self):
+ """
+ Regression for ticket #22421 -- loaddata on a model that inherits from
+ a grand-parent model with a M2M but via an abstract parent shouldn't
+ blow up.
+ """
+ management.call_command(
+ 'loaddata',
+ 'feature.json',
+ verbosity=0,
+ )
+
class NaturalKeyFixtureTests(TestCase):