Ticket #13710: 13712.diff

File 13712.diff, 811 bytes (added by tobias, 5 years ago)

test showing the specified query works (and this is not a bug)

  • tests/modeltests/raw_query/tests.py

    diff -r 2364ce5890bc tests/modeltests/raw_query/tests.py
    a b  
    169169        authors = Author.objects.all()
    170170        self.assertSuccessfulRawQuery(Author, query, authors, expected_annotations)
    171171
     172    def testJoin(self):
     173        query = "SELECT a.id, a.first_name FROM raw_query_author a INNER JOIN raw_query_book b ON a.id = b.author_id"
     174        authors = Author.objects.filter(book__isnull=False)
     175        self.assertSuccessfulRawQuery(Author, query, authors)
     176
    172177    def testInvalidQuery(self):
    173178        query = "UPDATE raw_query_author SET first_name='thing' WHERE first_name='Joe'"
    174179        self.assertRaises(InvalidQuery, Author.objects.raw, query)
Back to Top