On Mon, Jun 30, 2008 at 10:50 AM, Bobby Roberts <[EMAIL PROTECTED]> wrote:
> > i have a situation here. I'm trying to NOT use .html extensions in > this project. In other words i'd really like to just have my urls be > directories. The project consists of a series of forms and i'd like > them to proceed as follows: > > > mysite.com/step1/ > mysite.com/step2/ > mysite.com/step3/ > > > Part of the reason is so that the urls are as clean as possible and I > also believe that it's just added security because it's hard to tell > what language or platform something is running on (ie as apposed to > standard asp or php pages for example). > > The situation I'm experiencing is that I never leave the step1/ > directory. It all just stays in that directory and as a result, my > views are not functioning properly (ie the page loads but the form > fields on step 2 do not appear on the screen). > > here is my urls.py file (so far): > > from django.conf.urls.defaults import * > > urlpatterns = patterns('billpay.views', > # (r'^modules/', include('modules.foo.urls')), > (r'step1/$', 'DoPayDetailForm'), > (r'step2/$', 'DoPayInfoForm'), > ) > > urlpatterns += patterns('django.views.generic.simple', > (r'step1/$', 'direct_to_template', {'template': 'step1.html'}), > (r'step2/$', 'direct_to_template', {'template': 'step2.html'}), > ) > > > when form1 is_valid, the view saves form1 to session variables then > redirects to step2 as follows: > > return render_to_response("step2.html",'form': form}, > context_instance=RequestContext(request)) > > > The main issue i'm having is that i need this to redirect to > mysite.com/step2/ but it's staying at mysite.com/step1/ which results > in the view for step2 not being executed. > If you want to redirect to the step2 url, then you need to return an HttpResponseRedirect, not a render_to_response. See the simple view example flow here: http://www.djangoproject.com/documentation/newforms/#simple-view-example The usual hiccup people encounter for multi-step forms like this is keeping state, but you say you have already saved the form1 values as session variables so you shouldn't run into that problem. 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 -~----------~----~----~----~------~----~------~--~---