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.

I have this url in my urls.py

url(r'^step1/(?P<app_id>\d+)/$, RegistrantCreate.as_view(), 
name="registrant_add"),

I am trying to call the view this way:

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?



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a7a2ad99-0be5-4aa8-8c1f-05fc3e0b85c0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to