I have a mulit-page form I am building. I get the start page to enter the data for the application, validate and save. When I try using reverse to move to the next page I get this error:
NoReverseMatch at /requestform/start/Reverse for 'registrant_add' with arguments '()' and keyword arguments '{'app_id': 11}' not found.
url(r'^step1/(?P<app_id>\d+)/$, RegistrantCreate.as_view(), name="registrant_add"),
class ApplicationCreate(CreateView):
model = Application
form_class = ApplicationForm
slug_field = 'created_by'
template_name = 'requestform/start_form.html'
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(ApplicationCreate, self).dispatch(*args, **kwargs)
def form_valid(self, form):
obj = form.save(commit=False)
obj.created_by = self.request.user
obj.created = datetime.datetime.today()
obj.modified = datetime.datetime.today()
obj.save()
return HttpResponseRedirect(reverse('registrant_add', kwargs={'app_id':
obj.id}))
Why doesn't django recognize the named url 'registrant_add' and redirect to it?