From 2d6776ffe0b58f729f4372635b49a59da99ca206 Mon Sep 17 00:00:00 2001 From: Jeffrey Yancey Date: Thu, 28 Jun 2018 14:39:42 -0400 Subject: [PATCH] Fixed #29458 -- Doc'd how related_query_name affects Model._meta.get_field(). --- AUTHORS | 1 + docs/ref/models/meta.txt | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index dbb2880613..f95e3ea15d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -382,6 +382,7 @@ answer newbie questions, and generally made Django that much better: Jeff Hui Jeffrey Gelens Jeff Triplett + Jeffrey Yancey Jens Diemer Jens Page Jensen Cochran diff --git a/docs/ref/models/meta.txt b/docs/ref/models/meta.txt index 536f35d1d5..a02c357c40 100644 --- a/docs/ref/models/meta.txt +++ b/docs/ref/models/meta.txt @@ -33,8 +33,9 @@ Retrieving a single field instance of a model by name ``field_name`` can be the name of a field on the model, a field on an abstract or inherited model, or a field defined on another model that points to the model. In the latter case, the ``field_name`` - will be the ``related_name`` defined by the user or the name automatically - generated by Django itself. + will be (in order of preference) the :attr:`~.ForeignKey.related_query_name` + set by the user, the :attr:`~.ForeignKey.related_name` set by the user, or + the name automatically generated by Django. :attr:`Hidden fields ` cannot be retrieved by name.