[Django]-Django global name 'PageNotAnInteger' is not defined

19👍

You should import it first:

from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger

2👍

You can not use PageNotAnInteger without importing it.
So please import it first.

from django.core.paginator import PageNotAnInteger

If you need EmptyPage as well:

from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger

Leave a comment