title: Submitting form without redirects in Django
body: <p>In my main page I have included a template with form for adding emails to newsletter. I'd like this form to add new emails without redirecting anywhere. How I can achieve that ? Here is my code, when I was using separate page for this :</p>
  
  <p>views :</p>
  
  <pre><code>def newsletter_add(request):
      if request.POST:
          f = NewsletterForm(request.POST)
          if f.is_valid():
              try:
                  e = NewsletterEmails.objects.get(email = request.POST['email'])
                  msg = u'Mail already added'
                  return render_to_response('newsletter/add.html',
                      {'form':f,'msg':msg,},RequestContext(request))
              except Address.DoesNotExist:
                  e = NewsletterEmails(email = request.POST['email'])
                  e.save()
                  msg = u'Mail added'
                  return HttpResponseRedirect('/')
      else:
          f = NewsletterForm()
      return render_to_response('newsletter/add.html',{'form':f,},RequestContext(request))
  </code></pre>
  
  <p>form :</p>
  
  <pre><code>{% block content %}
      &lt;div class="center-right"&gt;
          &lt;div class="pane profile"&gt;
              &lt;div class="div-content"&gt;
                  {{ msg }}
                  &lt;form action="" method="post" enctype="multipart/form-data"&gt;
                      {{form.as_p}}
                      &lt;input type="submit" class="submit" name="submit" value="Ok" /&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>forms :</p>
  
  <pre><code>class NewsletterEmails(forms.Form):
      email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict,maxlength=75)),label=_("email"))
  </code></pre>