Opened 10 years ago

Last modified 10 years ago

#23094 closed Cleanup/optimization

QuerySet API docs: Sample code doesn't match — at Initial Version

Reported by: thegeekofalltrades@… Owned by: nobody
Component: Documentation Version: 1.7-beta-2
Severity: Normal Keywords: documentation error mismatch match sample
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

On the QuerySet API documentation page, under the section for select_related (https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_related), in the section about following foreign keys, the documentation reads:

"...then a call to Book.objects.select_related('person', 'person__city').get(id=4) will cache the related Person and the related City:"

and the sample code that follows it reads:

"b = Book.objects.select_related('person__city').get(id=4)"

The arguments passed to select_related do not match.

The error is present in both the Dev docs and the 1.7 docs.

Pardon the odd formatting on the double underscores. I tried to escape them in about eight different ways, and this was the best I could do.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top