'Regression test for #8825 and #9390
Make sure all inherited fields (esp. m2m fields, in this case) appear
on the child class.'

def test_inherited_fields(self):

    m2mchildren = list(M2MChild.objects.filter(articles__isnull=False))
    self.assertEqual(m2mchildren, [])
    qs = ArticleWithAuthor.objects.order_by('pub_date', 'pk')
    sql = qs.query.get_compiler(qs.db).as_sql()[0]
    fragment = sql[sql.find('ORDER    BY'):]
    pos = fragment.find('pub_date')
    self.assertEqual(fragment.find('pub_date', (pos + 1)), (-1))
