Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 20eb4bc

Browse files
charettessarahboyce
authored andcommitted
Refs #373 -- Adjusted test allowing AutoField in composite primary keys.
This is not a properly supported feature yet and should be revisited by refs #35957.
1 parent bfcb340 commit 20eb4bc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎tests/migrations/test_operations.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6562,6 +6562,9 @@ def test_add_field_after_generated_field(self):
65626562
def test_composite_pk_operations(self):
65636563
app_label = "test_d8d90af6"
65646564
project_state = self.set_up_test_model(app_label)
6565+
operation_0 = migrations.AlterField(
6566+
"Pony", "id", models.IntegerField(primary_key=True)
6567+
)
65656568
operation_1 = migrations.AddField(
65666569
"Pony", "pk", models.CompositePrimaryKey("id", "pink")
65676570
)
@@ -6571,12 +6574,12 @@ def test_composite_pk_operations(self):
65716574

65726575
# 1. Add field (pk).
65736576
new_state = project_state.clone()
6574-
operation_1.state_forwards(app_label, new_state)
6575-
withconnection.schema_editor() aseditor:
6576-
operation_1.database_forwards(app_label, editor, project_state, new_state)
6577+
new_state=self.apply_operations(
6578+
app_label, new_state, [operation_0, operation_1]
6579+
)
65776580
self.assertColumnNotExists(table_name, "pk")
65786581
Pony = new_state.apps.get_model(app_label, "pony")
6579-
obj_1 = Pony.objects.create(weight=1)
6582+
obj_1 = Pony.objects.create(id=1, weight=1)
65806583
msg = (
65816584
f"obj_1={obj_1}, "
65826585
f"obj_1.id={obj_1.id}, "

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /