Note that there are some explanatory texts on larger screens.

plurals
  1. POUser interface in python django
    primarykey
    data
    text
    <p>I new to Python and Django, i am trying to create a user interface using django for the calculation of the speed (speed= distance/time). I have created a project using django in that i have created a weapp called speed. The below are my files </p> <blockquote> <p>Webapp</p> <ul> <li><p>speed</p> <p>-Templates</p> <p>-views.py</p> <p>-forms.py</p> <p>-urls.py</p></li> <li><p>webapp</p> <p>-settings.py</p> <p>-urls.py</p> <p>-init.py</p> <p>-wsgi.py</p></li> </ul> </blockquote> <p>My codes: forms.py</p> <pre><code>from django import forms class Calculatespeed(forms.Form): distance=forms.CharField( required=True,max_length=10, widget=forms.TextInput(attrs={"placeholder":"0.0", "style":"width:100px"})) time=forms.CharField( required=True,max_length=10, widget=forms.TextInput(attrs={"placeholder":"0.0", "style":"width:100px"})) </code></pre> <p>views.py </p> <pre><code># Create your views here. from django.shortcuts import render from django import template from speed.forms import Calculatespeed def speed(Speed): distance=float(raw_input("Please Give the disance")) Time=float(raw_input("Please Give the Time")) Speed=distance/Time return Speed def Main(request): if request.GET: form = speed_form.SpeedForm(request.GET) if form.is_valid(): Distance = form.cleaned_data["distance"] Time = form.cleaned_data["time"] return shortcuts.render_response( "speed.html", page_context, context_instance=template.RequestContext(request) ) </code></pre> <p>Templates:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;WebApp1&lt;/title&gt; &lt;/head&gt; &lt;h1&gt;Speed Calculator&lt;/h1&gt; &lt;form action="/contact/" method="post"&gt; &lt;br&gt; Distance: &lt;input type="interger" distance="Distance" /&gt; &lt;br&gt; Time: &lt;input type="interger" Time="Time" /&gt; &lt;input type="submit" value="Submit" /&gt; </code></pre> <p>urls.py</p> <pre><code>from django.conf.urls import * from speed.views import speed urlpatterns = patterns('', url(r'^$', speed), ) </code></pre> <p>The problem is when i am trying run server i am getting an error i am unable to get the user interface of speed can any one help me on this.</p> <p>Is the templates files and all the other files which i gave are correct or not ??</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload