FD Manual 1-3
FD Manual 1-3
Develop a Django app that displays current date and time in server
views.py File
urls.py File
Output
2. Develop a Django app that displays date and time four hours ahead and four
hours before as an offset of current date and time in the server.
views.py File
urls.py File
Output
Steps to be followed while third program
3. Develop a simple Django app that displays an unordered list of fruits and
ordered list of selected students for an event
Index.html
<html>
</head>
<title>Home Page</title>
</head>
<body>
<h1>List of Fruits</h1>
<ul>
{% for item in fruit_list %}
<li>{{item}}</li>
{%endfor%}
</ul>
<h1>List of students</h1>
<ul>
{% for student in student_list %}
{%if student.score > 75%}
<li>{{student.name}}</li>
{%endif%}
{%endfor%}
</ul>
</body>
</html>
View.py
def homepage(request):
fruits=['Apple','Banana','Orange','Pineapple']
students = [
{'name': 'Harish', 'score': 85},
{'name': 'Briana', 'score': 70},
{'name': 'John', 'score': 95},
{'name': 'Arul', 'score': 60},
]
context={'fruit_list':fruits,'student_list':students,}
return render(request,"index.html",context)
ulrs.py
urlpatterns = [
path('admin/', admin.site.urls),
path('home/',homepage),
]
Output