Esempio n. 1
0
def index(request):
    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form = form.save(commit=False)
            return present_output(form)
    else:
        form = InputForm()

    return render_to_response('eco1.html', {'form': form},
                              context_instance=RequestContext(request))
Esempio n. 2
0
def index(request):
    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form = form.save(commit=False)
            return present_output(form)
    else:
        form = InputForm()

    return render_to_response('hw1.html',
            {'form': form}, context_instance=RequestContext(request))
Esempio n. 3
0
def index(request):
    os.chdir(os.path.dirname(__file__))
    result = None
    if request.method == "POST":
        form = InputForm(request.POST)
        if form.is_valid():
            form2 = form.save(commit=False)
            result = compute(form2.A, form2.b, form2.w, form2.T)
            result = result.replace("static/", "")
    else:
        form = InputForm()

    return render_to_response("vib1.html", {"form": form, "result": result}, context_instance=RequestContext(request))
Esempio n. 4
0
def index(request):
    s = None  # initial value of result
    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form = form.save(commit=False)
            r = form.r
            s = compute(r)
    else:
        form = InputForm()

    return render(request, 'math_app/index.html',
                  {'form': form,
                   's': s if isinstance(s, float) else ''})
Esempio n. 5
0
def index(request):
    s = None  # initial value of result
    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form = form.save(commit=False)
            r = form.r
            s = compute(r)
    else:
        form = InputForm()

    return render_to_response('hw2.html',
            {'form': form,
             's': '%.5f' % s if isinstance(s, float) else ''
             }, context_instance=RequestContext(request))
Esempio n. 6
0
def index(request):
    os.chdir(os.path.dirname(__file__))
    result = None
    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form2 = form.save(commit=False)
            result = compute(form2.A, form2.b, form2.w, form2.T)
            result = result.replace('static/', '')
    else:
        form = InputForm()

    return render_to_response('vib2.html',
            {'form': form,
             'result': result,
             }, context_instance=RequestContext(request))
Esempio n. 7
0
def index(request):
    s = None  # initial value of result
    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form = form.save(commit=False)
            r = form.r
            s = compute(r)
    else:
        form = InputForm()

    return render_to_response('hw2.html', {
        'form': form,
        's': '%.5f' % s if isinstance(s, float) else ''
    },
                              context_instance=RequestContext(request))
Esempio n. 8
0
def index(request):
    os.chdir(os.path.dirname(__file__))
    result = None
    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form2 = form.save(commit=False)
            result = compute(form2.A, form2.b, form2.w, form2.T)
            result = result.replace('static/', '')
    else:
        form = InputForm()

    return render_to_response('vib1.html', {
        'form': form,
        'result': result,
    },
                              context_instance=RequestContext(request))
def post_answer(request):
    #assign default value of result
    result = None

    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form2 = form.save(commit=False)
            result = compute(form2.Numsides)

    else:
        form = InputForm()

    #render the page
    return render(request,'CalculateProbability/post_answer.html',
            {'form': form,
             'result': result,
             })
Esempio n. 10
0
def index(request):

    os.chdir(os.path.dirname(__file__))
    result = None
    if request.method == 'POST':
        form = InputForm(request.POST)
        if form.is_valid():
            form2 = form.save(commit=False)
            result = compute(form2.R, form2.L, form2.Km, form2.b, form2.J,
                             form2.P)
            result = result.replace('static/', '')

    else:
        form = InputForm()

    return render(request, 'hw1.html', {
        'form': form,
        'result': result,
    })
Esempio n. 11
0
def index(request):
    os.chdir(os.path.dirname(__file__))
    result = None
    if request.method == 'POST':   #POST
        form = InputForm(request.POST) #POST
        if form.is_valid():
            form2 = form.save(commit=False)
            result = SPDC(form2.wavep, form2.angle, form2.L, form2.distz, form2.wp)#(wavep, angle, L, distz, wp)
            result = result.replace('static/', '')
    else:
        form = InputForm()
   
   ## context ={'form':form,
   ##           'result': result,
   ##           }

    return render(request,'vibb.html',  #return render_to_response('vibb.html',
            {'form': form,
             'result': result,
             })      ## }, context_instance=RequestContext(request))