On Thu, Nov 20, 2008 at 5:03 PM, ayayalar <[EMAIL PROTECTED]> wrote:

>
> VIEW:
>
> def add_product(request):
>    if not request.method == 'POST':
>        form1 = ProductForm()
>        return render_to_response('index.html', {'form1' : form1})
>    else:
>        form1 = ProductForm(request.POST)
>        if form1.is_valid():
>            form1.save()
>            return HttpResponseRedirect('/thanks.html')
>
>
> def add_product_details(request):
>    if not request.method == 'POST':
>        form2 = ProductDetailForm()
>        return render_to_response('index.html', {'form2' : form2})
>    else:
>        if form2.is_valid():
>            form2.save()
>            return HttpResponseRedirect('/thanks.html')
>
> URLS
> urlpatterns = patterns('',
>
>    (r'^product/$', views.add_product),
>    (r'^product/$', views.add_product_details),
>
>
> Is this possible? For some reason the 2nd form never shows up
>

A request is going to match only one url pattern (assuming a match is
found).  You seem to be expecting that one request will first match the
first (add_product) view you have specified and then when that is done the
2nd (add_product_details) one will get called.  That's not how it works.  If
you wont both the code that is in add_product and add_product_details to be
called for your r'^product/$' url, then you need to combine their code into
one function that you specify in a single urlentry for r^product/$'.  In
that combined view you need to create both forms and pass both of them in
the context to your template.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to