Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#12519 closed (fixed)

Incorrect Documentation for Model.objects.raw()

Reported by: boralyl Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: raw, sql, orm, models, db
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The first example under the Performing Raw Queries section (http://docs.djangoproject.com/en/dev/topics/db/sql/#django.db.models.Manager.raw) has an example of a simple model and then using the raw method of the model's objects. The example shows the result of printing the raw query as what looks like queryset results. In actuality the raw query is just printed back to the screen using the repr method. To execute the query it must be iterated over. The example makes it appear the RawQuerySet functions just like a QuerySet does when it is printed(query executed), which it does not.

It may be that this has not yet been implemented yet, and the documentation is for the final version, but just in case I figured I'd file this ticket.

Attachments (1)

rawqueryset-example-doc.diff (808 bytes) - added by eculver 4 years ago.
Update example to show that Manager.raw() returns RawQuerySet instance.

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by eculver

Update example to show that Manager.raw() returns RawQuerySet instance.

comment:1 Changed 4 years ago by eculver

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 4 years ago by russellm

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

(In [12561]) Fixed #12519 -- Corrected documentation on .raw() queries. Thanks to boralyl for the report and patch.

comment:4 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.