title: How to assign function to Django forms
body: <p>I would like to write a website with some calculators. Each calculator as separate app. I have ealier prepared and tested python code for main functions and now I have problem how to use it in Django. 
  I am not using Models, I am not sure but I think as it will be fast calculation by user and no need to store data in database so I decided to use only forms.</p>
  
  <ul>
  <li>My main question is how to assign function to a Django form? </li>
  <li>By the way,how to put clear python code properly to Django to
  keep 'good    practice of clean code'?</li>
  </ul>
  
  <p>My code:
  app <em>mathcalc:</em></p>
  
  <pre><code>mathcalc/views.py:
  
  def math_page(request):
      math_form = CalculationForm(request.POST or None)
      content = {
          "form": math_form
      }
      return render(request, 'math.html', content)
  
  class Calculator(object):
  
      def simpleFunction(self, a, b):
          score = a + b
          print(score)
          print('Tests gone well')
  
      def otherFunction(self):
          # function here
          return some stuff
  </code></pre>
  
  <p>and</p>
  
  <pre><code>in main project/forms.py:
  
  class CalculationForm(forms.Form):
      Years = forms.CharField()                  # a from simpleFunction
      Ammount = forms.CharField()                # b from simpleFunction
  </code></pre>
  
  <p>and</p>
  
  <pre><code>in math.html:
  &lt;form method='POST'&gt; {% csrf_token %}
      {{ form }}
  &lt;button type='submit' class='btn btn-default'&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I do not know how to connect it all, that after user input some data it will call <code>def simpleFunction</code>. How to assign Year charField to variable a and Ammount charField to variable b</p>