From af0f01558bb53553a1a7cd24f8121163c0069c85 Mon Sep 17 00:00:00 2001 From: Jonatas CD Date: Mon, 14 Nov 2016 10:18:41 +0100 Subject: [PATCH] [1.10.x] Fixed #26985 -- Doc'd that ForeignKey.to_field reference must be unique. Backport of 9da45ff352db1d1b7c64e5c724e9b0b31822b967 from master --- AUTHORS | 1 + docs/ref/models/fields.txt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 52aa5617a4..cc233f1b04 100644 --- a/AUTHORS +++ b/AUTHORS @@ -375,6 +375,7 @@ answer newbie questions, and generally made Django that much better: Jökull Sólberg Auðunsson Jon Dufresne Jonas Haag + Jonatas C. D. Jonathan Buchanan Jonathan Daugherty (cygnus) Jonathan Feignberg diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 8fe1d90dea..250311d9e6 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1426,7 +1426,8 @@ The possible values for :attr:`~ForeignKey.on_delete` are found in .. attribute:: ForeignKey.to_field The field on the related object that the relation is to. By default, Django - uses the primary key of the related object. + uses the primary key of the related object. If you reference a different + field, that field must have ``unique=True``. .. attribute:: ForeignKey.db_constraint