Ported pagination from django-bootstrap-toolkit