mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #373 -- Added CompositePrimaryKey.
Thanks Lily Foote and Simon Charette for reviews and mentoring this Google Summer of Code 2024 project. Co-authored-by: Simon Charette <charette.s@gmail.com> Co-authored-by: Lily Foote <code@lilyf.org>
This commit is contained in:
committed by
Sarah Boyce
parent
86661f2449
commit
978aae4334
@@ -1138,3 +1138,22 @@ class WriterTests(SimpleTestCase):
|
||||
ValueError, "'TestModel1' must inherit from 'BaseSerializer'."
|
||||
):
|
||||
MigrationWriter.register_serializer(complex, TestModel1)
|
||||
|
||||
def test_composite_pk_import(self):
|
||||
migration = type(
|
||||
"Migration",
|
||||
(migrations.Migration,),
|
||||
{
|
||||
"operations": [
|
||||
migrations.AddField(
|
||||
"foo",
|
||||
"bar",
|
||||
models.CompositePrimaryKey("foo_id", "bar_id"),
|
||||
),
|
||||
],
|
||||
},
|
||||
)
|
||||
writer = MigrationWriter(migration)
|
||||
output = writer.as_string()
|
||||
self.assertEqual(output.count("import"), 1)
|
||||
self.assertIn("from django.db import migrations, models", output)
|
||||
|
||||
Reference in New Issue
Block a user