I am just trying to make a website that calculates force=mass*accleration I have tried adding int it gives, string error or some base 10 error. #mass=int(request.GET['mass']) ...this too gives an error & all the variations of it!!!
views.py
from django.shortcuts import render
def home(request):
return render(request, 'home.html')
def calculator1(request):
mass = request.GET.get('mass')
acc = request.GET.get('acc')
print(mass)
print(acc)
force=mass*acc
return render(request, 'calculator1.html', {'result':force})```
urls.py
```from django.contrib import admin
from django.urls import path
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.home, name='home'),
path('calculator1', views.calculator1, name='calculator1'),
]```
calculator.html(a part of it)
```<a href="#" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Newton's Second Law of Motion</h5>
</div>
<form action="calculator1" method="get">
Force = mass * accleration<br>
mass = <input type="text" name="mass" size="7"><br>
accleration = <input type="text" name="acc" size="7"><br>
</form>
force = {{result}}
</a>
<button type="submit" class="btn btn-dark">Calculate</button><br>
</div>```
*help pleaseeee
I am just trying to make a website that calculates force=mass*accleration I have tried adding int it gives, string error or some base 10 error. #mass=int(request.GET['mass']) ...this too gives an error & all the variations of it!!!
views.py