Q: HttpResponseRedirect doesn't work after new_join.save() I tried to make simple request form. And I need to redirect user to "thank you" page after successful form sent. But after user hit "send" button - nothing happens. Just reload form page without form cleaning also.
Form is on "call" page, redirect needs "confirm" page...
So, task is: user fill the form on page "call" and after hitting "send" button, goes to "confirm" page.
My model:
# -*- coding: utf-8 -*- 

from django.db import models
from django.forms import ModelForm

# Create your models here.

class Join(models.Model):
    class Meta():
        db_table = 'expert_request'

user_expert = models.CharField(max_length=100)
user_name = models.CharField(max_length=100)
user_cost = models.CharField(max_length=100)
user_email = models.EmailField()
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=False, auto_now=True)

def __unicode__(self):
    return self.user_email

my "forms.py":
from django import forms
from userform.models import Join

class JoinForm(forms.ModelForm):
    class Meta:
        model = Join

This is my "views.py":
from django.shortcuts import render
from django.shortcuts import HttpResponseRedirect, Http404

# Create your views here.
from userform.forms import JoinForm
from userform.models import Join

def userform(request):

    form = JoinForm(request.POST or None)
    if form.is_valid():
        new_join = form.save(commit=False)
        new_join.save()
        HttpResponseRedirect('/confirm/')

    context = {"form": form}
    template = "userform.html"
    return render(request, template, context)

    def confirm(request):

    return render(request, 'confirm.html')

This is my URL's:
from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns('',

    url(r'^admin/', include(admin.site.urls)),

    (r'^tinymce/', include('tinymce.urls')),

    url(r'^$', 'expert.views.index', name='index'),
    url(r'^(\d+)/?$', 'expert.views.index'),

    url(r'^call/$', 'userform.views.userform', name='call'),
    url(r'^confirm/$', 'userform.views.confirm', name='confirm'),

)

My template "userform.html":
{% load staticfiles %}


<form style="position:relative" method="POST" action="">{% csrf_token %}
{{ form.user_expert }}
<p style="position:absolute; top:50px; left:20px; color:#FF0000;">{{     form.user_expert.errors.as_text }}</p>
{{ form.user_name }}
<p style="position:absolute; top:182px; left:20px; color:#FF0000;">{{ form.user_name.errors.as_text }}</p>
{{ form.user_cost }}
<p style="position:absolute; top:50px; left:380px; color:#FF0000;">{{ form.user_cost.errors.as_text }}</p>
{{ form.user_email }}
<p style="position:absolute; top:182px; left:380px; color:#FF0000;">{{ form.user_email.errors.as_text }}</p>
<button type="submit">Send</button>
<div class="clear"></div>
</form>


A: Maybe you forgot the return statement in userform view function? Fix its beginning like this:
def userform(request):

    form = JoinForm(request.POST or None)
    if form.is_valid():
        new_join = form.save(commit=False)
        new_join.save()
        return HttpResponseRedirect('/confirm/')

