commit | author | age
|
fe4f05
|
1 |
from django.shortcuts import render |
SP |
2 |
from django.http import HttpResponse |
|
3 |
|
|
4 |
from .forms import Stevila |
|
5 |
|
|
6 |
# Create your views here. |
|
7 |
|
|
8 |
|
|
9 |
def sestej(request): |
|
10 |
|
|
11 |
form=Stevila() |
|
12 |
vsota="NaN" |
|
13 |
|
|
14 |
if request.method == "POST": |
|
15 |
print(request.POST['a']) |
|
16 |
form=Stevila(request.POST) |
|
17 |
|
|
18 |
if form.is_valid(): |
|
19 |
vsota=float(form.data['a'])+float(form.data['b']) |
|
20 |
|
|
21 |
print(form.data) |
|
22 |
#form=Stevila() |
|
23 |
return render(request, 'calculator/sestej.html', context={'formular':form, 'vsota':vsota}) |
|
24 |
|