diff --git a/README.md b/README.md index 5b8955b4..8cce59e5 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,121 @@ Create a HTML file to implement form based input and output. Publish the website in the given URL. # PROGRAM : +math.html + + + + + Area of Rectangle + + + + + +
+
+ +

Area of a Rectangle

+ +
+ {% csrf_token %} + +
+ Length : + + (in m) +
+ +
+ Breadth : + + (in m) +
+ +
+ +
+ +
+ Area : + + m2 +
+
+ +
+
+ + + +views.py + +from django.shortcuts import render + +def rectarea(request): + context = {} + context['area'] = "0" + context['l'] = "0" + context['b'] = "0" + + if request.method == 'POST': + print("POST method is used") + l = request.POST.get('length', '') + b = request.POST.get('breadth', '') + + print('request =', request) + print('Length =', l) + print('Breadth =', b) + + area = int(l) * int(b) + + context['area'] = area + context['l'] = l + context['b'] = b + + print('Area =', area) + + return render(request, 'mathapp/math.html', context) + +urls.py + +from django.contrib import admin +from django.urls import path +from mathapp import views + +urlpatterns = [ + path('admin/', admin.site.urls), + path('areaofrectangle/', views.rectarea, name="areaofrectangle"), + path('', views.rectarea, name="areaofrectangleroot"), +] # SERVER SIDE PROCESSING: -# HOMEPAGE: +# HOMEPAGE: ![area](https://github.com/user-attachments/assets/0dfbdcae-0f21-4807-86f5-67ed3a3f55d0) + # RESULT: The program for performing server side processing is completed successfully.