1👍
your html file
<form method="POST" action=".">
<input type="text" name="fcal" value="{{F}}" />
<p>
<input type="submit" name="fibo" value="Fibonacci" />
</p>
</form>
{% if cal %}
Your Fibonacci answer is {{cal}}
{% endif %}
Your view:
def fibocal(request):
if request.method == 'POST':
fb = request.POST['fcal']
cal = fibonacci.fibo(fb)
return render(request, 'fibb/fibb.html', {'cal': cal})
else:
return render(request, 'fibb/fibb.html', {})
This will do the trick
👤sebb
Source:stackexchange.com