'Regression tests for #12893: Pagination in admins changelist doesn\'t
use queryset set by modeladmin.'

def test_pagination(self):

    parent = Parent.objects.create(name='anything')
    for i in range(30):
        Child.objects.create(name=('name    %s' % i), parent=parent)
        Child.objects.create(name=('filtered    %s' % i), parent=parent)
    request = MockRequest()
    m = ChildAdmin(Child, admin.site)
    cl = ChangeList(request, Child, m.list_display, m.list_display_links, m.list_filter, m.date_hierarchy, m.search_fields, m.list_select_related, m.list_per_page, m.list_editable, m)
    self.assertEqual(cl.query_set.count(), 60)
    self.assertEqual(cl.paginator.count, 60)
    self.assertEqual(cl.paginator.page_range, [1, 2, 3, 4, 5, 6])
    m = FilteredChildAdmin(Child, admin.site)
    cl = ChangeList(request, Child, m.list_display, m.list_display_links, m.list_filter, m.date_hierarchy, m.search_fields, m.list_select_related, m.list_per_page, m.list_editable, m)
    self.assertEqual(cl.query_set.count(), 30)
    self.assertEqual(cl.paginator.count, 30)
    self.assertEqual(cl.paginator.page_range, [1, 2, 3])
