0% found this document useful (0 votes)
19 views3 pages

Ordered and Unorderd List Program: View - Py

The document outlines a Django web application with views for home, about, and contact pages, using both ordered and unordered lists to display fruits and students. It includes HTML templates for each page and a URL configuration to route requests to the appropriate views. The code contains some syntax errors that need correction for proper functionality.

Uploaded by

Gowdru Hudga0127
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views3 pages

Ordered and Unorderd List Program: View - Py

The document outlines a Django web application with views for home, about, and contact pages, using both ordered and unordered lists to display fruits and students. It includes HTML templates for each page and a URL configuration to route requests to the appropriate views. The code contains some syntax errors that need correction for proper functionality.

Uploaded by

Gowdru Hudga0127
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ORDERED AND UNORDERD LIST PROGRAM

 [Link]

from [Link] import render

def home(request):
fruits = [‘orange’ , ’apple’ , ’mango’]
students = [‘john’ , ‘jani’ , ‘janardhan’]
context={‘students’ : students , ‘fruits’ : fruits}
return render (request, ‘[Link]’, context)

 [Link]

<HTML>
<body>
<h1>FRUITS</h1>
<ul>
{% for fruit in fruits %}
<li>{{fruit}}</li>
{% end for%}
</ul>
<h1>STUDENTS</h1>
<ol>
{% for student in students %}
<li>{{student}}</li>
{% end for%}
</ul>
</body>
</html>

 [Link]

from [Link] import path


from myapp import views

urlpa erns = [
path(‘home/', [Link]),
]
LAYOUT PROGRAM

 [Link]

<HTML>
<TITLE>{% block tle %} {% end block %}</TITLE>
<body>
<a href = ‘home/’>HOME</a>
<a href = ‘about/’>ABOUT</a>
<a href = ‘contact/’>CONTACT</a>
<sec on>{% block content %} {% end block %}
</body>
</html>

 [Link]

{% extends ‘myapp/[Link]’ %}
{% block tle %}ABOUT {% end block %}
{% block content %} THIS IS ABOUT PAGE{% end block %}

 [Link]

{% extends ‘myapp/[Link]’ %}
{% block tle %}CONTACT {% end block %}
{% block content %} THIS IS CONTACT PAGE{% end block %}

 [Link]

{% extends ‘myapp/[Link]’ %}
{% block tle %}HOME {% end block %}
{% block content %} THIS IS HOME PAGE{% end block %
 [Link]

from [Link] import render

def home(request):
retrun render(request , ‘myapp/[Link]’)

def about(request):
retrun render(request , ‘myapp/[Link]’)

def contact(request):
retrun render(request , ‘myapp/[Link]’)

 [Link]

from [Link] import path


from myapp import views

urlpa erns = [
path(‘home/', [Link]),
path(‘about/', [Link]),
path(‘contact/', [Link]),
]

You might also like