Skip to content

Commit 0ed834f

Browse files
committed
Specify foreign key as id
This works around #43 where foreign keys cannot be expressed as objects.
1 parent 5f64e3a commit 0ed834f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_on_conflict_nothing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def test_on_conflict_nothing_foreign_primary_key():
6262

6363
obj1 = (
6464
model.objects
65-
.on_conflict(['parent'], ConflictAction.NOTHING)
66-
.insert_and_get(parent=referenced_obj, cookies='cheers')
65+
.on_conflict(['parent_id'], ConflictAction.NOTHING)
66+
.insert_and_get(parent_id=referenced_obj.pk, cookies='cheers')
6767
)
6868

6969
obj1.refresh_from_db()
@@ -72,8 +72,8 @@ def test_on_conflict_nothing_foreign_primary_key():
7272

7373
obj2 = (
7474
model.objects
75-
.on_conflict(['parent'], ConflictAction.NOTHING)
76-
.insert_and_get(parent=referenced_obj, cookies='choco')
75+
.on_conflict(['parent_id'], ConflictAction.NOTHING)
76+
.insert_and_get(parent_id=referenced_obj.pk, cookies='choco')
7777
)
7878

7979
obj1.refresh_from_db()

0 commit comments

Comments
 (0)