Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#23094 closed Cleanup/optimization (fixed)

QuerySet API docs: Sample code doesn't match

Reported by: thegeekofalltrades@… Owned by: timo
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 (last modified by timo)

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.

Change History (4)

comment:1 Changed 9 months ago by timo

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 9 months ago by timo

  • Owner changed from nobody to timo
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

comment:3 Changed 9 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 5f919b9c81a26832f98033335a601ec1ca718db7:

Fixed #23094 -- Removed redundant argument in select_related() example.

Thanks thegeekofalltrades at gmail.com for the report.

comment:4 Changed 9 months ago by Tim Graham <timograham@…>

In 5822ca6c108e4cde134e55632dbaf79aeead1777:

[1.7.x] Fixed #23094 -- Removed redundant argument in select_related() example.

Thanks thegeekofalltrades at gmail.com for the report.

Backport of 5f919b9c81 from master

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