def object_page_number(paginator, obj): for p in paginator.page_range: if obj in paginator.page(p).object_list: return p return 0