Hey, Malcolm, maybe an example could help. I'm reading the forms
documentation at http://docs.djangoproject.com/en/dev//topics/forms/
and I see this code as part of the view function for a contact form:

def contact(request):
    if request.method == 'POST': # If the form has been submitted...
        form = ContactForm(request.POST) # A form bound to the POST
data
        if form.is_valid(): # All validation rules pass
            # Process the data in form.cleaned_data
            # ...
            return HttpResponseRedirect('/thanks/') # Redirect after
POST
    else:
        form = ContactForm() # An unbound form

    return render_to_response('contact.html', {
        'form': form,
    })

I'd like to know the best way to use this line:

return HttpResponseRedirect('/thanks/') # Redirect after POST

that's a redirect to an absolute, hard-coded, url: /thanks. I guess
that's not too portable, for example if I want to test at
http://development-server.com/subdirectory before going to
http://production-server.com/.

How should I setup my URLConf and use HttpResposeRedirect and reverse
in my view to be able to move my code independently of the domain or
directory structure?

Thanks!
--~--~---------~--~----~------------~-------~--~----~
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