[Django]-Getting a circular import error in django urls

7👍

The circular import is caused by reverse().

Solution: Use reverse_lazy.

from django.core.urlresolvers import reverse_lazy

class PresentValueView(CreateView):
    model = PresentValue
    template_name = 'present/pv.html'
    # fields = ['first', 'second']
    success_url = reverse_lazy('result')

Leave a comment