Raw queries are lazy: they aren't actually executed until they're iterated over.
(self)
| 142 | self.assertSuccessfulRawQuery(Author, query, authors) |
| 143 | |
| 144 | def test_raw_query_lazy(self): |
| 145 | """ |
| 146 | Raw queries are lazy: they aren't actually executed until they're |
| 147 | iterated over. |
| 148 | """ |
| 149 | q = Author.objects.raw("SELECT * FROM raw_query_author") |
| 150 | self.assertIsNone(q.query.cursor) |
| 151 | list(q) |
| 152 | self.assertIsNotNone(q.query.cursor) |
| 153 | |
| 154 | def test_FK_raw_query(self): |
| 155 | """ |