where to import reverse_lazy in django

from django.urls import reverse_lazy

  1. In the file where you are defining your views, import reverse_lazy from django.urls.
  2. Use reverse_lazy instead of reverse when dealing with generic class-based views to delay looking up the view until all the paths are defined and all the views are in memory.