[Type B] Chapter 15 Sumita Arora Solutions | Class 12 Computer Science

Here is class 12 computer science [Type B] Unit 15 solutions for Sumita Arora back exercise assignment. Below includes both textual and video solutions wherever required. View all the answers in assignment for chapter 15 and for all chapters here.

Sumita Arora Solutions for all lessons here.

Q1: Write a view function that can process a GET request and display “about.html” as template.  Required file(s) and method(s) are already imported.
$ from django.shortcuts import render

$ def about_view(request):
$    print(request.GET)
$    return render(request, "about.html")
Q2: Write a view function that can process a POST request and display “index.html” as template.  Required file(s) and method(s) are already imported.
$ from django.shortcuts import render

$ def index_view(request):
$     print(request.POST)
$     return render(request, "index.html")
Q3: You need to display a webpage team.html in response to URL <server>/about/team/ for app work in your Django project (namely Service).  Write the following:

(a) View function namely teamwork for team app
(b) URL conf for views teamwork
The template file team.html is available under templates folder of BASE DIRECTORY.
(a) View function
def teamwork(request):
    return render(request, 'team.html')

(b) url conf
from work.views import teamwork
urlpatterns = [
    path('about/team', teamwork),
    path('admin/', admin.site.urls)]
Q4: From the following URL Confs, identify the URLs and the view functions

(a) path(‘about/’,views.abt)
(b) path (‘news/’,views.modern)
(a) path(‘about/’,views.abt)
url is localhost:8000/about/ and view function is abt

(b) path (‘news/’,views.modern)
url is localhost:8000/news/ and view function is modern 

Clear Doubts with Computer Tutor
In case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in

You cannot copy content of this page