title: How can I close a popup and redirect to another page in a Django View?
body: <p>I have a popup window which processes a form. After button click I need to close the popup window and return to the main page.
  How can I do both actions in my Django view?</p>
  
  <pre><code>def InsertPopup (request):  
      if request.method == 'POST':  
          form = CustomerForm(request.POST)  
              if form.is_valid():  
                 form.save(True)  
                 return HttpResponse('&lt;script type="text/javascript"&gt;window.close()&lt;/script&gt;')  
  </code></pre>
  
  <p>This code works fine but after the 'window.close' script I want to redirect/get focus back on the main page which shall show the updated data.<br>
  Many thanks for help.</p>