Browse Source

Fixed #29458 -- Doc'd how related_query_name affects Model._meta.get_field().

Jeffrey Yancey 6 years ago
parent
commit
2d6776ffe0
2 changed files with 4 additions and 2 deletions
  1. 1 0
      AUTHORS
  2. 3 2
      docs/ref/models/meta.txt

+ 1 - 0
AUTHORS

@@ -382,6 +382,7 @@ answer newbie questions, and generally made Django that much better:
     Jeff Hui <jeffkhui@gmail.com>
     Jeffrey Gelens <jeffrey@gelens.org>
     Jeff Triplett <jeff.triplett@gmail.com>
+    Jeffrey Yancey <jeffrey.yancey@gmail.com>
     Jens Diemer <django@htfx.de>
     Jens Page
     Jensen Cochran <jensen.cochran@gmail.com>

+ 3 - 2
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 <django.db.models.Field.hidden>` cannot be retrieved
     by name.