From 9dd405973cc39c00e50e28869808fb0797fea2b4 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Fri, 13 Oct 2017 12:27:59 -0400 Subject: [PATCH] Corrected examples in related field descriptor docstrings. Using lowercased model class names suggested that accessing the attribute from instances of the class returned an instance of the descriptor, but this is only the case when accessed from the model class. --- django/db/models/fields/related_descriptors.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/django/db/models/fields/related_descriptors.py b/django/db/models/fields/related_descriptors.py index 189e67fab7..818c0d4d7c 100644 --- a/django/db/models/fields/related_descriptors.py +++ b/django/db/models/fields/related_descriptors.py @@ -79,7 +79,7 @@ class ForwardManyToOneDescriptor: class Child(Model): parent = ForeignKey(Parent, related_name='children') - ``child.parent`` is a ``ForwardManyToOneDescriptor`` instance. + ``Child.parent`` is a ``ForwardManyToOneDescriptor`` instance. """ def __init__(self, field_with_rel): @@ -254,7 +254,7 @@ class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor): class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant') - ``restaurant.place`` is a ``ForwardOneToOneDescriptor`` instance. + ``Restaurant.place`` is a ``ForwardOneToOneDescriptor`` instance. """ def get_object(self, instance): @@ -303,7 +303,7 @@ class ReverseOneToOneDescriptor: class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant') - ``place.restaurant`` is a ``ReverseOneToOneDescriptor`` instance. + ``Place.restaurant`` is a ``ReverseOneToOneDescriptor`` instance. """ def __init__(self, related): @@ -466,7 +466,7 @@ class ReverseManyToOneDescriptor: class Child(Model): parent = ForeignKey(Parent, related_name='children') - ``parent.children`` is a ``ReverseManyToOneDescriptor`` instance. + ``Parent.children`` is a ``ReverseManyToOneDescriptor`` instance. Most of the implementation is delegated to a dynamically defined manager class built by ``create_forward_many_to_many_manager()`` defined below. @@ -713,7 +713,7 @@ class ManyToManyDescriptor(ReverseManyToOneDescriptor): class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas') - ``pizza.toppings`` and ``topping.pizzas`` are ``ManyToManyDescriptor`` + ``Pizza.toppings`` and ``Topping.pizzas`` are ``ManyToManyDescriptor`` instances. Most of the implementation is delegated to a dynamically defined manager