ayayalar
2008-11-20 22:03:03 UTC
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---