mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[1.7.x] Fixed #22421 -- Regression in fixtures loading.
Loading fixtures were failing since the refactoring in244e2b71f5for inheritance setups where the chain contains abstract models and the root ancestor contains a M2M relation. Thanks Stanislas Guerra for the report. Refs #20946. Backport of862e1ff234from master
This commit is contained in:
committed by
Tim Graham
parent
485163f72c
commit
fb45e666c2
17
tests/fixtures_regress/fixtures/feature.json
Normal file
17
tests/fixtures_regress/fixtures/feature.json
Normal file
@@ -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
|
||||
}
|
||||
]
|
||||
@@ -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):
|
||||
|
||||
@@ -480,6 +480,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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user