title: How to perform calculation on a model attribute with input for form in django
body: <p>I'm new to Python/ Django here, but working hard</p>
  
  <p>To train myself, I'm working on a simple View that would<br>
  -take input through a form (DecimalField)<br>
  -Pass it to the View, where it perform calculation based on my Class Method<br>
  -Display it on my template, below to the InputForm itself and next to my other Class/Object attributes<br>
  <br>
  ++CODE UPDATE++ the value from the Form is intercepted and transmitted back to the template through {data} but I cannot pass it the the Model method...Where should I put the function instancing in the views ? or maybe I have an identation problem...<br>
  <br>
  in the end,  my template would look like :</p>
  
  <pre><code>&lt;br&gt;
  {% for list in list %}&lt;br&gt;
  &lt;div&gt; {{ list.price }} &lt;div&gt; &lt;div&gt; {{ list.newprice}} &lt;br&gt;&lt;br&gt;
  </code></pre>
  
  <p>with the css I'm already using of course</p>
  
  <p>Models:</p>
  
  <pre class="lang-py prettyprint-override"><code>class Product(models.Model):
      name = models.CharField(max_length=20)
      cost = models.DecimalField(decimal_places=2, max_digits=5)
      price = models.DecimalField(decimal_places=2, max_digits=5)
  
      def __str__(self):
          return self.name
  
      def newprice(self, input):
          newprice = self.price * input
          return newprice
  </code></pre>
  
  <p>Form:</p>
  
  <pre><code>class MultiplierForm(forms.Form):
      multiplier = forms.IntegerField(label='Your cost')
  </code></pre>
  
  <p>View: </p>
  
  <pre><code>def multi(request):
      list = Product.objects.all()
      data = 0
      if request.method == "POST":
          form = MultiplierForm(request.POST or None)
          if form.is_valid():
              data = request.POST.get('value_from_form')
  
      else : form = MultiForm(request.POST or None)
  
      p = Product.newprice() ##this code crash the server. 
                             ##If you I it above the else :form the template display
                             ## but crashes when I submit a value with a   
                             ## Function is Missing Argument error
      p(data)
  
      return render(request, 'viewinventory/multi.html', {'form': form, 'list': list, 'data': data})
  
  </code></pre>
  
  <p>++CODE UPDATE++ the value from the Form is intercepted and transmitted back to the template through {data} but I cannot pass it the the Model method...Where should I put the function instancing in the views ? or maybe I have an identation problem...
  I wish to remain simple and avoid going to uncharted territory like filter and all</p>