Ticket #12519: rawqueryset-example-doc.diff
File rawqueryset-example-doc.diff, 808 bytes (added by , 15 years ago) |
---|
-
docs/topics/db/sql.txt
25 25 26 26 .. method:: Manager.raw(raw_query, params=None, translations=None) 27 27 28 This method method takes a raw SQL query, executes it, and returns model29 instances.28 This method method takes a raw SQL query, executes it, and returns a 29 ``RawQuerySet`` instance. 30 30 31 31 This is best illustrated with an example. Suppose you've got the following model:: 32 32 … … 38 38 You could then execute custom SQL like so:: 39 39 40 40 >>> Person.objects.raw('SELECT * from myapp_person') 41 [<Person: John Doe>, <Person: Jane Doe>, ...]41 <RawQuerySet: 'SELECT * from myapp_person'> 42 42 43 43 .. admonition:: Model table names 44 44