Creating a Quote form in Django
<p>i am creating a django powered website. Specifically, a courier website. I need to create an application that serves as a quoting app. The user will type in the dimensions of the package into a form and after submitting the form, a price/quote will be returned , based on the dimensions inputted.</p>

<p>I have done this so far 
(views.py)</p>

<pre><code>from django.shortcuts import render, redirect
from quote.forms import QuoteForm

    def quoting(request):
        if request.method == 'GET':
            form = QuoteForm()
        else:
            form = QuoteForm(request.POST)
            if form.is_valid():
                Length = form.cleaned_data['Length']
                Breadth = form.cleaned_data['Breadth']
                Height = form.cleaned_data['Height']

                return redirect('thanks')
        return render(request, "quote/quote.html", {'form': form})
</code></pre>

<p>(forms.py)</p>

<pre><code>from django import forms

class QuoteForm(forms.Form):

    Length = forms.Integer()
    Breadth = forms.Integer()
    Height= forms.Integer()
</code></pre>

<p>(quote.html)</p>

<pre><code>{% extends "shop/base.html" %}
{% block content %}
&lt;form method="post"&gt;
    {% csrf_token %}
    {{ form }}
    &lt;div class="form-actions"&gt;
      &lt;button type="submit"&gt;Send&lt;/button&gt;
    &lt;/div&gt;
&lt;/form&gt;
{% endblock %}
</code></pre>

<p>Then i am aware i am lacking an html that would display the answer. I am not sure how to do this.</p>

<p>The price is determined by:</p>

<p>price= Shipping weight X distance
shipping weight= (length X breadth X height) / 5000</p>

<p>Thanks in advance :)</p>

<p>When i submit the form it returns to just the form with my inputs</p>

<p>(views.py)</p>

<pre><code>from django.http import HttpResponse, HttpResponseRedirect
    from django.shortcuts import render, redirect
    from quote.forms import QuoteForm


def quoting(request):
    if request.method == 'GET':
        form = QuoteForm()
    else:
        form = QuoteForm(request.POST)
        if form.is_valid():
            Length = form.cleaned_data['Length']
            Breadth = form.cleaned_data['Breadth']
            Height = form.cleaned_data['Height']
            totalprice=((Length*Breadth*Height)/5000)
    return render(request, "quote/quote.html", {'form': form})

def answer(request):
    return render(request,"quote/out.html")
</code></pre>

<p>(quote.html)</p>

<pre><code>{% extends "shop/base.html" %}
{% block content %}
&lt;form method="post"&gt;
{% csrf_token %}
{{ form }}
&lt;div class="form-actions"&gt;
&lt;button type="submit" action='/quote/out.html/'&gt;Send&lt;/button&gt;
&lt;/div&gt;
&lt;/form&gt;
{% endblock %}
</code></pre>

<p>(out.html)</p>

<pre><code>   {% extends "shop/base.html" %}
   {% block content %}
   {% if totalprice %}
   {{ totalprice }}
      {{ else }}
      {{form}}
{% endblock %}
</code></pre>

<p>(forms.py)</p>

<pre><code>from django import forms

class ContactForm(forms.Form):

    Length = forms.IntegerField(required=True)
    Breadth = forms.IntegerField(required=True)
    Height = forms.IntegerField()
</code></pre>

<p>(urls.py ( the app))</p>

<pre><code>from django.conf.urls import patterns, url
from django.views.generic import TemplateView
        url(r'^quoting/$',
            'quote.views.quoting',
            name='quoting'
            ),
        url(r'^answer/$',
            'quote.views.answer',
            name='answer'
            )
</code></pre>

python html django rest