#32372: Clarification of "RelatedManager" class example
-----------------------------------------+------------------------
Reporter: Jack | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I have a suggested clarification in the docs, under the "Related objects
reference" section:
[https://docs.djangoproject.com/en/3.1/ref/models/relations/].
One of the first examples of a ManyToMany field relationship begins with
an example of a Pizza model and a Toppings model, but in the shell example
below it demonstrates this relationship with two different models: a Blog
model and an Entry model.
I've read through this section a few times so I apologize in advance if
I'm incorrect in my understanding, but in my opinion it would be clearer
to stick with one set of classes for both the examples. If choosing to
continue with the Pizza and Toppings example, I would suggest changing the
example shown in the shell as follows:
{{{
>>> t = Topping.objects.get(id=1)
>>> p = Pizza.objects.get(id=5)
>>> t.pizza_set.add(p) # Associates Topping t with Pizza p.
}}}
If this is agreeable, I would love to make this change.
--
Ticket URL: <https://code.djangoproject.com/ticket/32372>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.3162e4f65553a9ef6368e320db83cf5c%40djangoproject.com.