title: Django: how to get input from one function to another function under views?
body: <p>I am a rookie for django and I know my question is very basic. I want to design a web application with two functions. The first function can let user to input a wav audio file name at home page. And the second function can read this audio file and analyze the audio signal and make fft plot. My each function works fine if I run individually, I just don't know how can I let my second function read the filename got from first function.</p>
  
  <p>This is my first function for input filename. </p>
  
  <pre><code>def home(request):
    form = EmailForm(request.POST or None)
    if form.is_valid():
          print form.cleaned_data['filename']
    context = {"form": form}
    template = "home.html"
    return render(request, template, context)
  </code></pre>
  
  <p>This is part of my second function:</p>
  
  <pre><code>def fftsound(request):
    from scipy import fft, arange, ifft
    from scipy.io import wavfile
    form = EmailForm(request.POST or None)
    if request.method == 'POST':    
        print "POST"
        if form.is_valid():
              print "valid"
              filename = form.cleaned_data.get('filename')
    else:
       form = EmailForm()
    rate,data=wavfile.read(filename)
  </code></pre>
  
  <p>My form looks like this:</p>
  
  <pre><code>class EmailForm(forms.Form):
    filename = forms.CharField(max_length=100, required=True)
  </code></pre>
  
  <p>And my models looks like this:</p>
  
  <pre><code>class application(models.Model):
    filename= models.CharField(max_length=100, blank=False, null=False)
    def __unicode__(self):
      return "%s" %(self.filename)
  </code></pre>
  
  <p>Now if I only run my first function, I can get the correct print on my terminal. I just don't know how to apply this input on my second function. Can any one help me with this? Thank you very much!</p>