0% found this document useful (0 votes)
27 views5 pages

Module2 FSD

Uploaded by

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

Module2 FSD

Uploaded by

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

Write a django app to greet the user using the

django templates
[Link]

from [Link] import render

# Create your views here.

def greet(request,user):
#uname=user
d={'user':user}
return render(request,'[Link]',d)

[Link]

from [Link] import admin


from [Link] import path

from [Link] import greet

urlpatterns = [
path('admin/', [Link]),
path('greet/<str:user>/',greet),
]

[Link]
INSTALLED_APPS = [
'[Link]',
'[Link]',
'[Link]',
'[Link]',
'[Link]',
'[Link]',
'greetUserApp',
]
[Link]

<!DOCTYPE html>
<html>
<head>
<title>Greet App</title>

</head>

<body>
<h1>{{user}} Good afternoon! Welcome to FDP on Full stack
development</h1>
</body>
</html>

1. Develop a simple Django app that displays an unordered list of fruits and
ordered list of selected students for an event
[Link]

from [Link] import render

# Create your views here.

def fruit_student(request):
fruitList=['Mango','Kiwi','Banana','Apple','Grapes']
studentList=['Rama','Chetan','Kumar','Harish','Geetha']
return render(request,'fruit_student.html',{'fruitList':fruitList,'studentList':sorted(studentList)})

[Link]

from [Link] import admin


from [Link] import path
from [Link] import fruit_student
urlpatterns = [
path('admin/', [Link]),
path('fruits/',fruit_student),
]
fruit_student.html

<!DOCTYPE html>
<html>
<head>
<style>
#a1{background-color: lightblue;color:brown}
#a2{background-color:blue;color:yellow}
</style>
<title>
Unordered Fruits and Ordered Students
</title>
</head>
<body>
<h1 id="a1">Unordered List of Fruits</h1>
<ul>
{% for fruit in fruitList %}
<li>{{fruit}}</li>
{% endfor %}
</ul>
<h1 id="a2">Ordered List of Students Selected for an Event</h1>
<ol>
{% for student in studentList %}
<li>{{student}}</li>
{% endfor %}
</ol>
</body>
</html>

2. Develop a [Link] with a suitable header (containing navigation menu) and footer
with copyright and developer information. Inherit this [Link] and create 3 additional
pages: contact us, About Us and Home page of any website.
[Link]

from [Link] import render

# Create your views here.

def home(request):
return render(request,'[Link]')
def contactus(request):
return render(request,'[Link]')
def aboutus(request):
return render(request,'[Link]')

[Link]

from [Link] import admin


from [Link] import path

from [Link] import aboutus, contactus, home


urlpatterns = [
path('admin/', [Link]),
path('',home),
path('contactus/',contactus),
path('aboutus/',aboutus),
path('home/',home),
]
[Link]

{% extends '[Link]' %}
{% block title %} ABOUT PAGE {% endblock %}
{% block content %}
<h1>About Us</h1>
<p>Dr. Harish Kumar B T, Asso. Prof, Dept of CSE, BIT</p>

{% endblock %}

[Link]

{% extends '[Link]' %}
{% block title %} Contact us {% endblock %}
{% block content %}
<h1>Contact us</h1>
<p>Name: Dr. Harish Kumar B T</p>
<p>Designation:Asso. Prof </p>
<p>Mobile: 9980119894</p>
<p>Email: harish.bitcse82@[Link]</p>
{% endblock %}

[Link]
{% extends '[Link]' %}
{% block title %} HOME Page {% endblock %}
{% block content %}
<h1>This is my home page</h1>
{% endblock %}

[Link]
<!DOCTYPE html>
<html>
<head>
<style>
nav{background-color: lightblue;padding: 15px;}
</style>
<title>
{% block title %} {% endblock %}
</title>
</head>
<body>
<nav>
<a href="/home/">HOME</a>
<a href="/contactus/">CONTACT US</a>
<a href="/aboutus/">ABOUT US</a>

</nav>
<section>
{% block content %} {% endblock %}
</section>
<footer>
<hr>
&copy; Designed and Developed by Dr. Harish Kumar B T, CSE, BIT, Bangalore-04
</footer>
</body>
</html>

Develop a Django app that displays a list of


subject codes and subject names of any semester
in tabular format. Even rows should have a light
green background color and subject names
should be in all caps

Develop a Django app that displays “Welcome to


Bangalore Institute of Technology” if flag is 1 else
display “Welcome to Dept. CSE for 5 day FDP on Full
Stack Development Using Django”

Develop a Django app that includes the footer


present in [Link] to all the other pages”

You might also like