SlideShare a Scribd company logo
1 of 45
Download to read offline
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 1
ExpNo : 1
Date :__/__/____
Pass or Fail
Aim:
Write a program which accepts marks of 3 subjects (out of 100) of a student. Check whether the student
has passed or not. (He will not pass if he secure less than 40 for any subjects).If passed Find whether he
secure Distinction (Above or equal to 80%), First class (Above or equal to 60%), Second class (Above or
equal to 50%) or Third Class (Above or equal to 40%)
Covered Topics:
Python variables and Data types, control structures
Programme:
mark1 = int(input("Enter the first mark: "))
mark2 = int(input("Enter the second mark: "))
mark3 = int(input("Enter the third mark: "))
total = mark1 + mark2 + mark3
percentage = total*100/300
if (mark1<40 or mark2<40 or mark3<40):
print("Failed")
elif (percentage <50):
print("Passed with Third Class")
elif (percentage <60):
print("Passed with Second Class")
elif (percentage <80):
print("Passed with First Class")
else:
print("Passed with Distinction")
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 2
Output
1. Enter the first mark: 78
Enter the second mark: 98
Enter the third mark: 45
Passed with First Class
2. Enter the first mark: 54
Enter the second mark: 34
Enter the third mark: 78
Failed
RESULT:
The program is compiled, executed and the output is verified.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 3
ExpNo : 2
Date :__/__/____
Math Game
Aim:
Write a math-game program that accepts a 3-digit integer from the user five times. On each input, if the
number is a multiple of 7, display the message “You Won” and stop the execution, otherwise show the
message “Try again”. If the user fails in all 5 attempts, show the message “Better luck next time” and stop.
Covered Topics:
Python variables and Data types, control structures, Loops
Programme:
print ("MATH-GAME")
for i in range(1,6):
num = int(input("Enter the 3-digit number: "))
if (num%7 == 0):
print ("Congratulations*******You Won")
exit()
if (i<5):
print ("Try again...")
else:
print ("Better luck next time")
exit()
Output
1. MATH-GAME
Enter the 3-digit number: 777
Congratulations*******You Won
2. MATH-GAME
Enter the 3-digit number: 234
Try again...
Enter the 3-digit number: 675
Try again...
Enter the 3-digit number: 323
Try again...
Enter the 3-digit number: 675
Try again...
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 4
Enter the 3-digit number: 342
Better luck next time
RESULT:
The program is compiled, executed and the output is verified.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 5
ExpNo : 3
Date :__/__/____
List, Dictionary and Set
Aim:
Write a program to read the name of 5 employees into a list and their year of birth to another list in order.
Merge them into a single dictionary with the name as key and year of birth as value. Also display the years
of birth without duplicates.
Covered Topics:
Python variables and Data types, Loops, List, Dictionary, Set
Programme:
emp_name_list = list() # or simply emp_name_list = []
year_list = list()
emp_dict = dict() # or simply emp_dict = {}
year_set = set()
for i in range(0,5):
print ("Enter the name of employee "+ str(i+1) + ": ")
emp_name = input()
emp_name_list.append(emp_name)
print ("Enter the birth year of employee "+ str(i+1) + ": ")
year = int(input())
year_list.append(year)
for i in range(0,5):
emp_dict[emp_name_list[i]] = year_list[i]
year_set.add(year_list[i])
print ("nDictionary is: ")
print (emp_dict)
print ("nYear set is: ")
print (year_set)
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 6
Output
Enter the name of employee 1:
Rajeev
Enter the birth year of employee 1:
1990
Enter the name of employee 2:
Syam
Enter the birth year of employee 2:
1990
Enter the name of employee 3:
Nirmala
Enter the birth year of employee 3:
1992
Enter the name of employee 4:
Ram
Enter the birth year of employee 4:
1989
Enter the name of employee 5:
Sajith
Enter the birth year of employee 5:
1987
Dictionary is:
{'Rajeev': 1990, 'Syam': 1990, 'Nirmala': 1992, 'Ram': 1989, 'Sajith': 1987}
Year set is:
{1992, 1987, 1989, 1990}
RESULT:
The program is compiled, executed and the output is verified.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 7
ExpNo : 4
Date :__/__/____
Class and Object
Aim:
Write a program to read the name and number of tyres of three vehicles and display the summary using
class.
Covered Topics:
Python variables and Data types, class, objects
Programme:
class Vehicle:
name = ""
tyre = 0
veh1 = Vehicle()
print ("Enter the name of Vehicle : ")
veh1.name = input()
print ("Enter the Number of Tyres : ")
veh1.tyre = input()
veh2 = Vehicle()
print ("Enter the name of Vehicle : ")
veh2.name = input()
print ("Enter the Number of Tyres : ")
veh2.tyre = input()
veh3 = Vehicle()
print ("Enter the name of Vehicle : ")
veh3.name = input()
print ("Enter the Number of Tyres : ")
veh3.tyre = input()
print ("nnVEHICLE SUMMARYn***************")
print(f"{veh1.name} has {veh1.tyre} tyres")
print(f"{veh2.name} has {veh2.tyre} tyres")
print(f"{veh3.name} has {veh3.tyre} tyres")
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 8
Output
Enter the name of Vehicle :
Bus
Enter the Number of Tyres :
6
Enter the name of Vehicle :
car
Enter the Number of Tyres :
4
Enter the name of Vehicle :
bike
Enter the Number of Tyres :
2
VEHICLE SUMMARY
***************
Bus has 6 tyres
car has 4 tyres
bike has 2 tyres
RESULT:
The program is compiled, executed and the output is verified.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 9
ExpNo : 5
Date :__/__/____
Python and django framework installation
Aim:
To Install and familiarize of Python and Django framework.
Proceedure:
Django is a Python framework that makes it easier to create web sites using Python. Django takes care of
the difficult stuff so that you can concentrate on building your web applications.Django emphasizes
reusability of components, also referred to as DRY (Don't Repeat Yourself), and comes with ready-to-use
features like login system, database connection and CRUD operations (Create Read Update Delete).
Django follows the MVT design pattern (Model View Template).
 Model - The data you want to present, usually data from a database.
 View - A request handler that returns the relevant template and content - based on the request from
the user.
 Template - A text file (like an HTML file) containing the layout of the web page, with logic on
how to display the data.
Installation of Python Django Frame work
1. Install Python
Django Requires Python.To check if your system has Python installed, run this command in the
command prompt
python –version
If Python is installed, you will get a result with the version number, like this
Python 3.9.2
If you find that you do not have Python installed on your computer, then you can download it for
free from the following website: https://www.python.org
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 10
Download the file and install python.
2. Install a Code Editor
There are many code editors available for programming with Python. VSCode is one of the most
used code editor for python and Django combinations.
You can download it for free from the following website: https://code.visualstudio.com
You can select the operating system and download the installation file and double click to install.
After Installing Start vscode
Now the following window opens. Then select extensions.
VS Code extensions let you add languages, debuggers, and tools to your installation to support
your development workflow. Search python extension and install. Python extension helps to edit
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 11
your code with auto-completion, code navigation, syntax checking and more. Then install django
extension.
The create a folder and drag it to the vscode.
Then you can see the folder in the explorer section of vscode.
3. Create a virtual environment
The virtual environment is an environment which is used by Django to execute an application. It is
recommended to create and execute a Django application in a separate environment. Python
provides a tool virtualenv to create an isolated Python environment.
Select the terminal and new terminal. Then the terminal opens.
Then type the command and press enter.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 12
python -m venv djangoenv
The djangoenv is the environment name that we given. Then the virtual environment name is
shown under the folder name in explorer.
Then activate the virtual environment by the following command
djangoenvscriptsactivate
Then the terminal shown like this
4. Installing Django
Install the django environment to the virtual environment that we create.
Connect to the internet and type the following command and enter
pip install django
After Successful installation we can see the django package under the environment that we
Create.
Create Django project using the command
django-admin startproject proj_name
Enter into the project directory
cd proj_name
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 13
Migrations are Django‟s way of propagating changes you make to your models (adding a field,
deleting a model, etc.) into your database schema.
migration is run through the following command for a Django project.
Python manage.py migrate
To run the Django development server, type the command
python manage.py runserver
in your terminal of the Django project and hit enter. If everything is okay with your project,
Django will start running the server at localhost port 8000 (127.0. 0.1:8000) and then you have to
navigate to that link in your browser.
RESULT:
Installed Python and Django framework successfully.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 14
ExpNo : 6
Date :__/__/____
Django URL and Views
Aim:
Develop a home page and display the page and different displays according to the URL that we given.
Proceedure:
Django project is the whole website. A Django application is a Python package that is specifically
intended for use in a Django project. An application may use common Django conventions, such as
having models , tests , urls , and views submodules.A django project may contains any number of apps.
Create the project
django-admin startproject proj1
Enter in to the directory
cd proj1
Create app
Python manage,py startapp home
Manage the app as part of the project
Take settings.py of project. Add the app in the installed apps section. Then save.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 15
Django follows the MVT design pattern. The MVT(Model View Template) is a software design pattern.
Django work as follows.
Gets user requests by URL and responds back by map that route to call specified view function.To handle
URL,django.urls module was used by the framework.
Insert a URL in projects urls.py and forward it to apps urls.py and map it to the apps views,py.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 16
Take urls.py of project.Set the path of app url.Then save
Then create urls.py file in app directory and copy the contents of projects urls.py in to apps urls.py.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 17
Delete the admin path and insert the views function.
Here we use three views.‟ „ means root .
Define all functions in the views.py of app.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 18
Run the server. Open a web browser and enter the address http:://127.0.0.1:8000.Then we can see the web
page define in index function.
http:://127.0.0.1:8000/about
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 19
http:://127.0.0.1:8000/contacts
RESULT:
Successfully created the web page.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 20
ExpNo : 7
Date :__/__/____
Login Page Creation
Aim:
Create a simple login page with username and password using the Django framework.
Proceedure:
Here we use django templates. A template describes an html page and contains variables which are
swapped out for content which makes them dynamic. Go to the base folder and create a new folder
named templates.
Here we create the html file index.html.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 21
In the code window type ht then the menu contains html5-boilerplate will appear.Select it.
HTML basic structure will be displayed
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 22
The type HTML code to create the login form inside <head>..</head> and <body>..</body> tags. Save the
file.
Inside < head> tags
<style>
Body {
font-family: Calibri, Helvetica, sans-serif;
background-color: #586876 ;
}
.container {
padding: 25px;
background-color: #1E2C42;
color: white;
}
input[type=text], input[type=password] {
width: 50%;
margin: 8px 0;
padding: 12px 20px;
display: inline-block;
border: 2px solid green;
box-sizing: border-box;
}
button {
background-color: #586876;
color: white;
width: 25%;
padding: 15px;
margin: 10px 0px;
border: none;
cursor: pointer;
}
</style>
Inside <body> tags
<form> <br><br>
<div class="container">
<center>
<h1> Student Login Form </h1>
<label><h3>Username </h3></label>
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 23
<input type="text" placeholder="Enter Username" ><br>
<label><h3>Password <h3> </label>
<input type="password" placeholder="Enter Password" ><br>
<button type="submit">Login</button> </center>
</div>
</form>
Set the urls.py of project and urls.py of app as in the earlier application
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 24
Go to the view.py of app. Then make the template as response. Save the file.
Then add the templates folder in the project settings. Open settings.py of project .Then go to teplates
part and add our directory templates to „DIRS‟ and save the file.
Run the server and see the result in the browser by giving the address
http:://127.0.0.1:8000
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 25
RESULT:
Successfully created the login page.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 26
ExpNo : 8
Date :__/__/____
User registration and Login
Aim:
Create a user registration and login form. If the login is successful display message in another page.
Proceedure:
Create a project named proj1
django-admin startproject Proj1
Create an App inside the project
cd proj1
python manage.py startapp login
Projects settings.py
Projects urls.py
from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^$', views.index_redirect, name='index_redirect'),
url(r'^web/', include('login.urls')),
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 27
url(r'^admin/', admin.site.urls),
]
Projects views.py
from django.shortcuts import redirect
from . import views
def index_redirect(request):
return redirect('/web/')
Apps urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^login/$', views.login, name='login'),
url(r'^home/$', views.home, name='home'),
]
Apps views.py
from django.shortcuts import render, redirect, HttpResponseRedirect
from .models import Member
# Create your views here.
def index(request):
if request.method == 'POST':
member = Member(username=request.POST['username'],
password=request.POST['password'], firstname=request.POST['firstname'],
lastname=request.POST['lastname'])
member.save()
return redirect('/')
else:
return render(request, 'index.html')
def login(request):
return render(request, 'login.html')
def home(request):
if request.method == 'POST':
if Member.objects.filter(username=request.POST['username'],
password=request.POST['password']).exists():
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 28
member = Member.objects.get(username=request.POST['username'],
password=request.POST['password'])
return render(request, 'home.html', {'member': member})
else:
context = {'msg': 'Invalid username or password'}
return render(request, 'login.html', context)
Apps models.py
from django.db import models
# Create your models here.
class Member(models.Model):
firstname=models.CharField(max_length=30)
lastname=models.CharField(max_length=30)
username=models.CharField(max_length=30)
password=models.CharField(max_length=12)
def __str__(self):
return self.firstname + " " + self.lastname
Create a folder templates in app directory and create these html files
Home.html
<style>
body {
background-color: #76CAD1;
}
</style>
{% block body %}
<h3 class="text-primary"><center> Login Successfull</h3></center>
<Font color="D64C11"> <center> <h2>Welcome</h2>
<h1> <b> {{ member.firstname }}</h1><b></font>
{% endblock %}
Index.html
<style>
body {
background-color: #76CAD1;
}
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 29
</style>
{% block body %}
<form method="POST">
{% csrf_token %}
<div class="col-md-8"><b>
<div class="form-group">
<h3 class="text-primary"><center> Registration Form</h3></center>
<label for="username">Username</label>
<input type="text" name="username" class="form-control" required="required">
</div><br>
<div class="form-group">
<label for="password">Password&nbsp;</label>
<input type="password" name="password" class="form-control"
required="required"/>
</div><br>
<div class="form-group">
<label for="firstname">Firstname</label>
<input type="text" name="firstname" class="form-control"
required="required"/>
</div><br>
<div class="form-group">
<label for="lastname">Lastname&nbsp;</label>
<input type="text" name="lastname" class="form-control"
required="required"/>
</div><br>
<br />
<div class="form-group">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <button type="submit"
class="btn btn-primary form-control"> Submit</button>
</div><br><br>
<div class="col-md-2">
<h2><a href="{% url 'login' %}">Login</a></h2>
</div>
</div>
</form>
{% endblock %}
Login.html
<style>
body {
background-color: #76CAD1;
}
</style>
{% block body %}
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 30
<b>
<form method="POST" action="{% url 'home' %}">
{% csrf_token %}
<div class="col-md-8">
<div class="form-group">
<h3 class="text-primary"><center> Login</h3></center>
<label for="username">Username</label>
<input type="text" name="username" class="form-control"
required="required"/>
</div><br>
<div class="form-group">
<label for="password">Password&nbsp;</label>
<input type="password" name="password" class="form-control"
required="required"/>
</div>
<center><label class="text-danger">{{ msg }}</label></center>
<br />
<div class="form-group">
<button class="btn btn-primary form-control"><span class="glyphicon
glyphicon-log-in"></span> Login</button>
</div><br><br>
<div class="col-md-2">
<h2> <a href="{% url 'index' %}">Signup</a>
</div>
</div>
</form>
{% endblock %}
Make the migrations
python manage.py makemigrations
python manage.py migrate
Run Development Server
python manage.py runserver
View the Result
open the browser and take http://127.0.0.1:8000/
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 31
Create a user and login with that user.
We get the home page
RESULT:
Successfully created the page.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 32
ExpNo : 9
Date :__/__/____
Department Website
Aim:
Create a website for the department..
Proceedure:
Create a project named web.
django-admin startproject web
Create an App inside the project
cd web
python manage.py startapp dept
settings.py
web urls.py
from django.contrib import admin
from django.urls import path,include
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('dept.urls'))
]+ static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 33
MEDIA_URL: Similar to the STATIC_URL , this is the URL where users can access media files.
MEDIA_ROOT: The absolute path to the directory where your Django application will serve your media
files from.
Dept urls.py
from django.contrib import admin
from django.urls import path,include
from . import views
urlpatterns = [
path('', views.homes,name='homes'),
path('vision',views.vision,name='vision'),
path('staff',views.staff,name='staff'),
path('contact',views.contact,name='contact'),
path('gallery',views.gallery,name='gallery'),
path('placement',views.placement,name='placement'),
]
Views.py
from django.shortcuts import render
from .models import depthome,deptvision,deptstaff,deptplace,depgallery,deptcontact
# Create your views here.
def homes(request):
dict_dept={
'dept':depthome.objects.all()
}
return render(request,'home.html',dict_dept)
def vision(request):
dict_vis={
'vis':deptvision.objects.all()
}
return render(request,'vision.html',dict_vis)
def staff(request):
dict_staffs={
'staffs':deptstaff.objects.all()
}
return render(request,'staff.html',dict_staffs)
def contact(request):
dict_cont={
'cont':deptcontact.objects.all()
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 34
}
return render(request,'contact.html',dict_cont)
def gallery(request):
dict_gal={
'gal':depgallery.objects.all()
}
return render(request,'gallery.html',dict_gal)
def placement(request):
dict_place={
'place':deptplace.objects.all()
}
return render(request,'placement.html',dict_place)
models.py
from django.db import models
class depthome(models.Model):
dep_name=models.CharField(max_length=100)
dep_description=models.TextField()
dep_image=models.ImageField(upload_to='dep')
class deptvision(models.Model):
vis_image=models.ImageField(upload_to='dep')
vis_description=models.TextField()
class deptstaff(models.Model):
staff_name=models.CharField(max_length=100)
staff_description=models.TextField()
staff_image=models.ImageField(upload_to='dep')
class deptplace(models.Model):
place_name=models.CharField(max_length=100)
place_description=models.TextField()
place_image=models.ImageField(upload_to='dep')
class depgallery(models.Model):
gal_name=models.CharField(max_length=100)
gal_image=models.ImageField(upload_to='dep')
class deptcontact(models.Model):
cont_name=models.CharField(max_length=100)
cont_address=models.TextField()
cont_email=models.TextField()
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 35
cont_phone=models.TextField()
The Python Imaging Library adds image processing capabilities to your Python interpreter.This library
provides extensive file format support, an efficient internal representation, and fairly powerful image
processing capabilities.The core image library is designed for fast access to data stored in a few basic pixel
formats. It should provide a solid foundation for a general image processing tool.Install pillow.
python -m pip install Pillow
admin.py
from django.contrib import admin
from .models import depthome,deptvision,deptstaff,deptplace,depgallery,deptcontact
# Register your models here.
admin.site.register(depthome)
admin.site.register(deptvision)
admin.site.register(deptstaff)
admin.site.register(deptplace)
admin.site.register(depgallery)
admin.site.register(deptcontact)
create the folder templates and create the html files.
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 36
Base.html
<html>
<head>
<link rel="stylesheet"
href=" https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css ">
<link rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.2.0/css/all.css">
</head>
<body>
<nav class="navbar bg-dark navbar-expand-md ">
<div class="container">
<h3 class="text-white"> Department of Computer Hardware Engineering </h3>
</div>
<div class="collapse navbar-collapse justify-content-center ">
<ul class="navbar-nav justify-content-center fw-bold">
<li class="nav-item active">
<a class="nav-link text-white" href="{% url 'homes' %}">Home </a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="{% url 'vision'
%}">Vision&Mission</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="{% url 'staff' %}">People</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="{% url 'placement'
%}">Placements</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="{% url 'gallery' %}">Gallery</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="{% url 'contact' %}">Contact</a>
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 37
</li>
</ul>
</div>
</div>
</nav>
{% block content %} {% endblock %}
<section class="fixed-bottom">
<footer class="pt-2 pb-2 bg-dark text-light">
<div class="container">
<div class="row align-items-center">
<center><h4>Government Polytechnic College Nedumkandam</h4><center>
</div>
</div>
</footer>
</section>
</body>
</html>
Home.html
{% extends 'base.html' %}
{% block content %}
<body style="background-color:#DAD6D5;">
<div class="mx-auto bg-secondary text-justify text-light p-4 my-4 w-75 border rounded">
{% for d in dept%}
<h1><center>{{d.dep_name}}</h1></center>
<center><img src="{{d.dep_image}}"</center>>
<p>{{d.dep_description}}</p>
</div>
{% endfor %}
</body>
{% endblock %}
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 38
Staff.html
{% extends 'base.html' %}
{% block content %}
<body style="background-color:#DAD6D5;">
<div class="container bg-dark text-center my-4">
{% for d in staffs%}
<div class="card my-4 mx-3 text-center" style="width: 14rem; display:inline-
block">
<img src="{{d.staff_image}}..." class="card-img-top" alt="...">
<div class="card-body">
<center><h5 class="card-title">{{d.staff_name}}</h5>
<p class="card-text">{{d.staff_description}}</p></center>
</div>
</div>
{% endfor %}
</div>
</body>
{% endblock %}
Vision.html
{% extends 'base.html' %}
{% block content %}
<body style="background-color:#DAD6D5;">
{% for d in vis%}
<div class="mx-auto bg-secondary text-justify text-light p-4 my-4 w-75 border rounded">
<center><img src="{{d.vis_image}}"height="90" width="90"></center>
<p><h5>{{d.vis_description}}<h5></p>
</div>
{% endfor %}
</body>
{% endblock %}
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 39
Placement.html
{% extends 'base.html' %}
{% block content %}
<body style="background-color:#DAD6D5;">
<div class="container bg-dark text-center my-1 text-white">
<h3> Placements Got in 2022</h3>
<br><h4>Congratulations</h4>
{% for d in place%}
<div class="card my-1 mx-3 text-center" style="width: 14rem; display:inline-
block">
<img src="{{d.place_image}}..." class="card-img-top" alt="...">
<div class="card-body text-dark">
<center><h5 class="card-title">{{d.place_name}}</h5>
<p class="card-text">{{d.place_description}}</p></center>
</div>
</div>
{% endfor %}
</div>
</body>
{% endblock %}
Gallery.html
{% extends 'base.html' %}
{% block content %}
<body style="background-color:#DAD6D5;">
<div class="container bg-dark text-center my-4">
{% for d in gal%}
<div class="card my-4 mx-3 text-center" style="width: 14rem; display:inline-
block">
<img src="{{d.gal_image}}..." class="card-img-top" alt="..." height="150"
width="50">
<div class="card-body">
<center><h5 class="card-title">{{d.gal_name}}</h5>
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 40
</div>
</div>
{% endfor %}
</div>
</body>
{% endblock %}
Contact.html
{% extends 'base.html' %}
{% block content %}
<body style="background-color:#DAD6D5;">
<div class="mx-auto bg-dark text-justify text-light p-4 my-4 w-75 border rounded">
{% for d in cont%}
<h2>{{d.cont_name}}</h2>
<h4>{{d.cont_address}}</h4>
<h4>{{d.cont_email}}</h4>
<h4>{{d.cont_phone}}</h4>
</div>
{% endfor %}
<br><br><br><br>
<center><h5>Designed by<br> Sreekanth M G <Br>GPTC
Nedumkandam<br>Mob:9497761221<h5><center>
</body>
{% endblock %}
Run the development server
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 41
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 42
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 43
We can manage the data in the website by using admin panel.
Create a superuser
python manage.py createsuperuser
Then enter the Username of your choice and press enter.
Username: srishti
Then enter the Email address and press enter.(It can be left blank)
Email address: example@gmail.com
Next, enter the Password in-front of the Password field and press enter.Enter a strong
password so as to keep it secure.
Password: ******
Then again enter the same Password for confirmation.
Password(again): ******
Superuser created successfully if above fields are entered correctly.
Enter the URL http://127.0.0.1:8000/admin in browser
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 44
Enter the username and password
Then the admin panel appears. Here we can see all the models that we create
Application Development Lab S4 CT
Prepared By
Sreekanth M G ,GPTC Nedumkandam Page. 45
We can add data to any models by using add button
RESULT:
Successfully created the web site of department.

More Related Content

Similar to ADLAB.pdf

java program assigment -1
java program assigment -1java program assigment -1
java program assigment -1Ankit Gupta
 
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docxSpring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docxrafbolet0
 
Final opensource record 2019
Final opensource record 2019Final opensource record 2019
Final opensource record 2019Karthik Sekhar
 
Java Practical File Diploma
Java Practical File DiplomaJava Practical File Diploma
Java Practical File Diplomamustkeem khan
 
CIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.comCIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.combellflower82
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   llflowe
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   bellflower42
 
Char word counter in Python with simple gui - PROJECT
Char word counter in Python with simple gui - PROJECTChar word counter in Python with simple gui - PROJECT
Char word counter in Python with simple gui - PROJECTMahmutKAMALAK
 
Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com  Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com amaranthbeg143
 
Refactoring for High Cohesiveness in Designing Robust Python Modules
Refactoring for High Cohesiveness in Designing Robust Python ModulesRefactoring for High Cohesiveness in Designing Robust Python Modules
Refactoring for High Cohesiveness in Designing Robust Python ModulesIRJET Journal
 
CSE215_Module_02_Elementary_Programming.ppt
CSE215_Module_02_Elementary_Programming.pptCSE215_Module_02_Elementary_Programming.ppt
CSE215_Module_02_Elementary_Programming.pptRashedurRahman18
 
Introduction Machine Learning by MyLittleAdventure
Introduction Machine Learning by MyLittleAdventureIntroduction Machine Learning by MyLittleAdventure
Introduction Machine Learning by MyLittleAdventuremylittleadventure
 
CIS 170 Effective Communication - tutorialrank.com
CIS 170 Effective Communication - tutorialrank.comCIS 170 Effective Communication - tutorialrank.com
CIS 170 Effective Communication - tutorialrank.comBartholomew19
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfjanakim15
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
 
Week 2PRG 218 Variables and Input and Output OperationsWrite.docx
Week 2PRG 218   Variables and Input and Output OperationsWrite.docxWeek 2PRG 218   Variables and Input and Output OperationsWrite.docx
Week 2PRG 218 Variables and Input and Output OperationsWrite.docxmelbruce90096
 

Similar to ADLAB.pdf (20)

java program assigment -1
java program assigment -1java program assigment -1
java program assigment -1
 
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docxSpring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
 
Final opensource record 2019
Final opensource record 2019Final opensource record 2019
Final opensource record 2019
 
Java Practical File Diploma
Java Practical File DiplomaJava Practical File Diploma
Java Practical File Diploma
 
CIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.comCIS 170 Focus Dreams/newtonhelp.com
CIS 170 Focus Dreams/newtonhelp.com
 
CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   CIS 170 Life of the Mind/newtonhelp.com   
CIS 170 Life of the Mind/newtonhelp.com   
 
CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   CIS 170 Imagine Your Future/newtonhelp.com   
CIS 170 Imagine Your Future/newtonhelp.com   
 
Char word counter in Python with simple gui - PROJECT
Char word counter in Python with simple gui - PROJECTChar word counter in Python with simple gui - PROJECT
Char word counter in Python with simple gui - PROJECT
 
Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com  Cis 170 Extraordinary Success/newtonhelp.com
Cis 170 Extraordinary Success/newtonhelp.com
 
clicks2conversations.pdf
clicks2conversations.pdfclicks2conversations.pdf
clicks2conversations.pdf
 
Refactoring for High Cohesiveness in Designing Robust Python Modules
Refactoring for High Cohesiveness in Designing Robust Python ModulesRefactoring for High Cohesiveness in Designing Robust Python Modules
Refactoring for High Cohesiveness in Designing Robust Python Modules
 
Linux_C_LabBasics.ppt
Linux_C_LabBasics.pptLinux_C_LabBasics.ppt
Linux_C_LabBasics.ppt
 
CSE215_Module_02_Elementary_Programming.ppt
CSE215_Module_02_Elementary_Programming.pptCSE215_Module_02_Elementary_Programming.ppt
CSE215_Module_02_Elementary_Programming.ppt
 
Introduction Machine Learning by MyLittleAdventure
Introduction Machine Learning by MyLittleAdventureIntroduction Machine Learning by MyLittleAdventure
Introduction Machine Learning by MyLittleAdventure
 
CIS 170 Effective Communication - tutorialrank.com
CIS 170 Effective Communication - tutorialrank.comCIS 170 Effective Communication - tutorialrank.com
CIS 170 Effective Communication - tutorialrank.com
 
C and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdfC and Data structure lab manual ECE (2).pdf
C and Data structure lab manual ECE (2).pdf
 
Cp manual final
Cp manual finalCp manual final
Cp manual final
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
P3
P3P3
P3
 
Week 2PRG 218 Variables and Input and Output OperationsWrite.docx
Week 2PRG 218   Variables and Input and Output OperationsWrite.docxWeek 2PRG 218   Variables and Input and Output OperationsWrite.docx
Week 2PRG 218 Variables and Input and Output OperationsWrite.docx
 

Recently uploaded

WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsCharles Obaleagbon
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...Amil baba
 
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一Fi L
 
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130Suhani Kapoor
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdfvaibhavkanaujia
 
Architecture case study India Habitat Centre, Delhi.pdf
Architecture case study India Habitat Centre, Delhi.pdfArchitecture case study India Habitat Centre, Delhi.pdf
Architecture case study India Habitat Centre, Delhi.pdfSumit Lathwal
 
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证nhjeo1gg
 
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一Fi sss
 
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Servicejennyeacort
 
306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social MediaD SSS
 
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一Fi L
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Sitegalleryaagency
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdfSwaraliBorhade
 
Call Girls Meghani Nagar 7397865700 Independent Call Girls
Call Girls Meghani Nagar 7397865700  Independent Call GirlsCall Girls Meghani Nagar 7397865700  Independent Call Girls
Call Girls Meghani Nagar 7397865700 Independent Call Girlsssuser7cb4ff
 
NATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailNATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailDesigntroIntroducing
 
Introduction-to-Canva-and-Graphic-Design-Basics.pptx
Introduction-to-Canva-and-Graphic-Design-Basics.pptxIntroduction-to-Canva-and-Graphic-Design-Basics.pptx
Introduction-to-Canva-and-Graphic-Design-Basics.pptxnewslab143
 

Recently uploaded (20)

Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonCheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past Questions
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
 
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
 
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdf
 
Architecture case study India Habitat Centre, Delhi.pdf
Architecture case study India Habitat Centre, Delhi.pdfArchitecture case study India Habitat Centre, Delhi.pdf
Architecture case study India Habitat Centre, Delhi.pdf
 
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
 
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
 
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
 
306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media
 
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Site
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf
 
Call Girls Meghani Nagar 7397865700 Independent Call Girls
Call Girls Meghani Nagar 7397865700  Independent Call GirlsCall Girls Meghani Nagar 7397865700  Independent Call Girls
Call Girls Meghani Nagar 7397865700 Independent Call Girls
 
NATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailNATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detail
 
Introduction-to-Canva-and-Graphic-Design-Basics.pptx
Introduction-to-Canva-and-Graphic-Design-Basics.pptxIntroduction-to-Canva-and-Graphic-Design-Basics.pptx
Introduction-to-Canva-and-Graphic-Design-Basics.pptx
 
Call Girls in Pratap Nagar, 9953056974 Escort Service
Call Girls in Pratap Nagar,  9953056974 Escort ServiceCall Girls in Pratap Nagar,  9953056974 Escort Service
Call Girls in Pratap Nagar, 9953056974 Escort Service
 

ADLAB.pdf

  • 1. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 1 ExpNo : 1 Date :__/__/____ Pass or Fail Aim: Write a program which accepts marks of 3 subjects (out of 100) of a student. Check whether the student has passed or not. (He will not pass if he secure less than 40 for any subjects).If passed Find whether he secure Distinction (Above or equal to 80%), First class (Above or equal to 60%), Second class (Above or equal to 50%) or Third Class (Above or equal to 40%) Covered Topics: Python variables and Data types, control structures Programme: mark1 = int(input("Enter the first mark: ")) mark2 = int(input("Enter the second mark: ")) mark3 = int(input("Enter the third mark: ")) total = mark1 + mark2 + mark3 percentage = total*100/300 if (mark1<40 or mark2<40 or mark3<40): print("Failed") elif (percentage <50): print("Passed with Third Class") elif (percentage <60): print("Passed with Second Class") elif (percentage <80): print("Passed with First Class") else: print("Passed with Distinction")
  • 2. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 2 Output 1. Enter the first mark: 78 Enter the second mark: 98 Enter the third mark: 45 Passed with First Class 2. Enter the first mark: 54 Enter the second mark: 34 Enter the third mark: 78 Failed RESULT: The program is compiled, executed and the output is verified.
  • 3. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 3 ExpNo : 2 Date :__/__/____ Math Game Aim: Write a math-game program that accepts a 3-digit integer from the user five times. On each input, if the number is a multiple of 7, display the message “You Won” and stop the execution, otherwise show the message “Try again”. If the user fails in all 5 attempts, show the message “Better luck next time” and stop. Covered Topics: Python variables and Data types, control structures, Loops Programme: print ("MATH-GAME") for i in range(1,6): num = int(input("Enter the 3-digit number: ")) if (num%7 == 0): print ("Congratulations*******You Won") exit() if (i<5): print ("Try again...") else: print ("Better luck next time") exit() Output 1. MATH-GAME Enter the 3-digit number: 777 Congratulations*******You Won 2. MATH-GAME Enter the 3-digit number: 234 Try again... Enter the 3-digit number: 675 Try again... Enter the 3-digit number: 323 Try again... Enter the 3-digit number: 675 Try again...
  • 4. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 4 Enter the 3-digit number: 342 Better luck next time RESULT: The program is compiled, executed and the output is verified.
  • 5. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 5 ExpNo : 3 Date :__/__/____ List, Dictionary and Set Aim: Write a program to read the name of 5 employees into a list and their year of birth to another list in order. Merge them into a single dictionary with the name as key and year of birth as value. Also display the years of birth without duplicates. Covered Topics: Python variables and Data types, Loops, List, Dictionary, Set Programme: emp_name_list = list() # or simply emp_name_list = [] year_list = list() emp_dict = dict() # or simply emp_dict = {} year_set = set() for i in range(0,5): print ("Enter the name of employee "+ str(i+1) + ": ") emp_name = input() emp_name_list.append(emp_name) print ("Enter the birth year of employee "+ str(i+1) + ": ") year = int(input()) year_list.append(year) for i in range(0,5): emp_dict[emp_name_list[i]] = year_list[i] year_set.add(year_list[i]) print ("nDictionary is: ") print (emp_dict) print ("nYear set is: ") print (year_set)
  • 6. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 6 Output Enter the name of employee 1: Rajeev Enter the birth year of employee 1: 1990 Enter the name of employee 2: Syam Enter the birth year of employee 2: 1990 Enter the name of employee 3: Nirmala Enter the birth year of employee 3: 1992 Enter the name of employee 4: Ram Enter the birth year of employee 4: 1989 Enter the name of employee 5: Sajith Enter the birth year of employee 5: 1987 Dictionary is: {'Rajeev': 1990, 'Syam': 1990, 'Nirmala': 1992, 'Ram': 1989, 'Sajith': 1987} Year set is: {1992, 1987, 1989, 1990} RESULT: The program is compiled, executed and the output is verified.
  • 7. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 7 ExpNo : 4 Date :__/__/____ Class and Object Aim: Write a program to read the name and number of tyres of three vehicles and display the summary using class. Covered Topics: Python variables and Data types, class, objects Programme: class Vehicle: name = "" tyre = 0 veh1 = Vehicle() print ("Enter the name of Vehicle : ") veh1.name = input() print ("Enter the Number of Tyres : ") veh1.tyre = input() veh2 = Vehicle() print ("Enter the name of Vehicle : ") veh2.name = input() print ("Enter the Number of Tyres : ") veh2.tyre = input() veh3 = Vehicle() print ("Enter the name of Vehicle : ") veh3.name = input() print ("Enter the Number of Tyres : ") veh3.tyre = input() print ("nnVEHICLE SUMMARYn***************") print(f"{veh1.name} has {veh1.tyre} tyres") print(f"{veh2.name} has {veh2.tyre} tyres") print(f"{veh3.name} has {veh3.tyre} tyres")
  • 8. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 8 Output Enter the name of Vehicle : Bus Enter the Number of Tyres : 6 Enter the name of Vehicle : car Enter the Number of Tyres : 4 Enter the name of Vehicle : bike Enter the Number of Tyres : 2 VEHICLE SUMMARY *************** Bus has 6 tyres car has 4 tyres bike has 2 tyres RESULT: The program is compiled, executed and the output is verified.
  • 9. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 9 ExpNo : 5 Date :__/__/____ Python and django framework installation Aim: To Install and familiarize of Python and Django framework. Proceedure: Django is a Python framework that makes it easier to create web sites using Python. Django takes care of the difficult stuff so that you can concentrate on building your web applications.Django emphasizes reusability of components, also referred to as DRY (Don't Repeat Yourself), and comes with ready-to-use features like login system, database connection and CRUD operations (Create Read Update Delete). Django follows the MVT design pattern (Model View Template).  Model - The data you want to present, usually data from a database.  View - A request handler that returns the relevant template and content - based on the request from the user.  Template - A text file (like an HTML file) containing the layout of the web page, with logic on how to display the data. Installation of Python Django Frame work 1. Install Python Django Requires Python.To check if your system has Python installed, run this command in the command prompt python –version If Python is installed, you will get a result with the version number, like this Python 3.9.2 If you find that you do not have Python installed on your computer, then you can download it for free from the following website: https://www.python.org
  • 10. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 10 Download the file and install python. 2. Install a Code Editor There are many code editors available for programming with Python. VSCode is one of the most used code editor for python and Django combinations. You can download it for free from the following website: https://code.visualstudio.com You can select the operating system and download the installation file and double click to install. After Installing Start vscode Now the following window opens. Then select extensions. VS Code extensions let you add languages, debuggers, and tools to your installation to support your development workflow. Search python extension and install. Python extension helps to edit
  • 11. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 11 your code with auto-completion, code navigation, syntax checking and more. Then install django extension. The create a folder and drag it to the vscode. Then you can see the folder in the explorer section of vscode. 3. Create a virtual environment The virtual environment is an environment which is used by Django to execute an application. It is recommended to create and execute a Django application in a separate environment. Python provides a tool virtualenv to create an isolated Python environment. Select the terminal and new terminal. Then the terminal opens. Then type the command and press enter.
  • 12. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 12 python -m venv djangoenv The djangoenv is the environment name that we given. Then the virtual environment name is shown under the folder name in explorer. Then activate the virtual environment by the following command djangoenvscriptsactivate Then the terminal shown like this 4. Installing Django Install the django environment to the virtual environment that we create. Connect to the internet and type the following command and enter pip install django After Successful installation we can see the django package under the environment that we Create. Create Django project using the command django-admin startproject proj_name Enter into the project directory cd proj_name
  • 13. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 13 Migrations are Django‟s way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema. migration is run through the following command for a Django project. Python manage.py migrate To run the Django development server, type the command python manage.py runserver in your terminal of the Django project and hit enter. If everything is okay with your project, Django will start running the server at localhost port 8000 (127.0. 0.1:8000) and then you have to navigate to that link in your browser. RESULT: Installed Python and Django framework successfully.
  • 14. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 14 ExpNo : 6 Date :__/__/____ Django URL and Views Aim: Develop a home page and display the page and different displays according to the URL that we given. Proceedure: Django project is the whole website. A Django application is a Python package that is specifically intended for use in a Django project. An application may use common Django conventions, such as having models , tests , urls , and views submodules.A django project may contains any number of apps. Create the project django-admin startproject proj1 Enter in to the directory cd proj1 Create app Python manage,py startapp home Manage the app as part of the project Take settings.py of project. Add the app in the installed apps section. Then save.
  • 15. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 15 Django follows the MVT design pattern. The MVT(Model View Template) is a software design pattern. Django work as follows. Gets user requests by URL and responds back by map that route to call specified view function.To handle URL,django.urls module was used by the framework. Insert a URL in projects urls.py and forward it to apps urls.py and map it to the apps views,py.
  • 16. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 16 Take urls.py of project.Set the path of app url.Then save Then create urls.py file in app directory and copy the contents of projects urls.py in to apps urls.py.
  • 17. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 17 Delete the admin path and insert the views function. Here we use three views.‟ „ means root . Define all functions in the views.py of app.
  • 18. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 18 Run the server. Open a web browser and enter the address http:://127.0.0.1:8000.Then we can see the web page define in index function. http:://127.0.0.1:8000/about
  • 19. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 19 http:://127.0.0.1:8000/contacts RESULT: Successfully created the web page.
  • 20. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 20 ExpNo : 7 Date :__/__/____ Login Page Creation Aim: Create a simple login page with username and password using the Django framework. Proceedure: Here we use django templates. A template describes an html page and contains variables which are swapped out for content which makes them dynamic. Go to the base folder and create a new folder named templates. Here we create the html file index.html.
  • 21. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 21 In the code window type ht then the menu contains html5-boilerplate will appear.Select it. HTML basic structure will be displayed
  • 22. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 22 The type HTML code to create the login form inside <head>..</head> and <body>..</body> tags. Save the file. Inside < head> tags <style> Body { font-family: Calibri, Helvetica, sans-serif; background-color: #586876 ; } .container { padding: 25px; background-color: #1E2C42; color: white; } input[type=text], input[type=password] { width: 50%; margin: 8px 0; padding: 12px 20px; display: inline-block; border: 2px solid green; box-sizing: border-box; } button { background-color: #586876; color: white; width: 25%; padding: 15px; margin: 10px 0px; border: none; cursor: pointer; } </style> Inside <body> tags <form> <br><br> <div class="container"> <center> <h1> Student Login Form </h1> <label><h3>Username </h3></label>
  • 23. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 23 <input type="text" placeholder="Enter Username" ><br> <label><h3>Password <h3> </label> <input type="password" placeholder="Enter Password" ><br> <button type="submit">Login</button> </center> </div> </form> Set the urls.py of project and urls.py of app as in the earlier application
  • 24. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 24 Go to the view.py of app. Then make the template as response. Save the file. Then add the templates folder in the project settings. Open settings.py of project .Then go to teplates part and add our directory templates to „DIRS‟ and save the file. Run the server and see the result in the browser by giving the address http:://127.0.0.1:8000
  • 25. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 25 RESULT: Successfully created the login page.
  • 26. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 26 ExpNo : 8 Date :__/__/____ User registration and Login Aim: Create a user registration and login form. If the login is successful display message in another page. Proceedure: Create a project named proj1 django-admin startproject Proj1 Create an App inside the project cd proj1 python manage.py startapp login Projects settings.py Projects urls.py from django.conf.urls import include, url from django.contrib import admin from . import views urlpatterns = [ url(r'^$', views.index_redirect, name='index_redirect'), url(r'^web/', include('login.urls')),
  • 27. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 27 url(r'^admin/', admin.site.urls), ] Projects views.py from django.shortcuts import redirect from . import views def index_redirect(request): return redirect('/web/') Apps urls.py from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^login/$', views.login, name='login'), url(r'^home/$', views.home, name='home'), ] Apps views.py from django.shortcuts import render, redirect, HttpResponseRedirect from .models import Member # Create your views here. def index(request): if request.method == 'POST': member = Member(username=request.POST['username'], password=request.POST['password'], firstname=request.POST['firstname'], lastname=request.POST['lastname']) member.save() return redirect('/') else: return render(request, 'index.html') def login(request): return render(request, 'login.html') def home(request): if request.method == 'POST': if Member.objects.filter(username=request.POST['username'], password=request.POST['password']).exists():
  • 28. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 28 member = Member.objects.get(username=request.POST['username'], password=request.POST['password']) return render(request, 'home.html', {'member': member}) else: context = {'msg': 'Invalid username or password'} return render(request, 'login.html', context) Apps models.py from django.db import models # Create your models here. class Member(models.Model): firstname=models.CharField(max_length=30) lastname=models.CharField(max_length=30) username=models.CharField(max_length=30) password=models.CharField(max_length=12) def __str__(self): return self.firstname + " " + self.lastname Create a folder templates in app directory and create these html files Home.html <style> body { background-color: #76CAD1; } </style> {% block body %} <h3 class="text-primary"><center> Login Successfull</h3></center> <Font color="D64C11"> <center> <h2>Welcome</h2> <h1> <b> {{ member.firstname }}</h1><b></font> {% endblock %} Index.html <style> body { background-color: #76CAD1; }
  • 29. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 29 </style> {% block body %} <form method="POST"> {% csrf_token %} <div class="col-md-8"><b> <div class="form-group"> <h3 class="text-primary"><center> Registration Form</h3></center> <label for="username">Username</label> <input type="text" name="username" class="form-control" required="required"> </div><br> <div class="form-group"> <label for="password">Password&nbsp;</label> <input type="password" name="password" class="form-control" required="required"/> </div><br> <div class="form-group"> <label for="firstname">Firstname</label> <input type="text" name="firstname" class="form-control" required="required"/> </div><br> <div class="form-group"> <label for="lastname">Lastname&nbsp;</label> <input type="text" name="lastname" class="form-control" required="required"/> </div><br> <br /> <div class="form-group"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <button type="submit" class="btn btn-primary form-control"> Submit</button> </div><br><br> <div class="col-md-2"> <h2><a href="{% url 'login' %}">Login</a></h2> </div> </div> </form> {% endblock %} Login.html <style> body { background-color: #76CAD1; } </style> {% block body %}
  • 30. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 30 <b> <form method="POST" action="{% url 'home' %}"> {% csrf_token %} <div class="col-md-8"> <div class="form-group"> <h3 class="text-primary"><center> Login</h3></center> <label for="username">Username</label> <input type="text" name="username" class="form-control" required="required"/> </div><br> <div class="form-group"> <label for="password">Password&nbsp;</label> <input type="password" name="password" class="form-control" required="required"/> </div> <center><label class="text-danger">{{ msg }}</label></center> <br /> <div class="form-group"> <button class="btn btn-primary form-control"><span class="glyphicon glyphicon-log-in"></span> Login</button> </div><br><br> <div class="col-md-2"> <h2> <a href="{% url 'index' %}">Signup</a> </div> </div> </form> {% endblock %} Make the migrations python manage.py makemigrations python manage.py migrate Run Development Server python manage.py runserver View the Result open the browser and take http://127.0.0.1:8000/
  • 31. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 31 Create a user and login with that user. We get the home page RESULT: Successfully created the page.
  • 32. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 32 ExpNo : 9 Date :__/__/____ Department Website Aim: Create a website for the department.. Proceedure: Create a project named web. django-admin startproject web Create an App inside the project cd web python manage.py startapp dept settings.py web urls.py from django.contrib import admin from django.urls import path,include from django.conf.urls.static import static from django.conf import settings urlpatterns = [ path('admin/', admin.site.urls), path('', include('dept.urls')) ]+ static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
  • 33. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 33 MEDIA_URL: Similar to the STATIC_URL , this is the URL where users can access media files. MEDIA_ROOT: The absolute path to the directory where your Django application will serve your media files from. Dept urls.py from django.contrib import admin from django.urls import path,include from . import views urlpatterns = [ path('', views.homes,name='homes'), path('vision',views.vision,name='vision'), path('staff',views.staff,name='staff'), path('contact',views.contact,name='contact'), path('gallery',views.gallery,name='gallery'), path('placement',views.placement,name='placement'), ] Views.py from django.shortcuts import render from .models import depthome,deptvision,deptstaff,deptplace,depgallery,deptcontact # Create your views here. def homes(request): dict_dept={ 'dept':depthome.objects.all() } return render(request,'home.html',dict_dept) def vision(request): dict_vis={ 'vis':deptvision.objects.all() } return render(request,'vision.html',dict_vis) def staff(request): dict_staffs={ 'staffs':deptstaff.objects.all() } return render(request,'staff.html',dict_staffs) def contact(request): dict_cont={ 'cont':deptcontact.objects.all()
  • 34. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 34 } return render(request,'contact.html',dict_cont) def gallery(request): dict_gal={ 'gal':depgallery.objects.all() } return render(request,'gallery.html',dict_gal) def placement(request): dict_place={ 'place':deptplace.objects.all() } return render(request,'placement.html',dict_place) models.py from django.db import models class depthome(models.Model): dep_name=models.CharField(max_length=100) dep_description=models.TextField() dep_image=models.ImageField(upload_to='dep') class deptvision(models.Model): vis_image=models.ImageField(upload_to='dep') vis_description=models.TextField() class deptstaff(models.Model): staff_name=models.CharField(max_length=100) staff_description=models.TextField() staff_image=models.ImageField(upload_to='dep') class deptplace(models.Model): place_name=models.CharField(max_length=100) place_description=models.TextField() place_image=models.ImageField(upload_to='dep') class depgallery(models.Model): gal_name=models.CharField(max_length=100) gal_image=models.ImageField(upload_to='dep') class deptcontact(models.Model): cont_name=models.CharField(max_length=100) cont_address=models.TextField() cont_email=models.TextField()
  • 35. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 35 cont_phone=models.TextField() The Python Imaging Library adds image processing capabilities to your Python interpreter.This library provides extensive file format support, an efficient internal representation, and fairly powerful image processing capabilities.The core image library is designed for fast access to data stored in a few basic pixel formats. It should provide a solid foundation for a general image processing tool.Install pillow. python -m pip install Pillow admin.py from django.contrib import admin from .models import depthome,deptvision,deptstaff,deptplace,depgallery,deptcontact # Register your models here. admin.site.register(depthome) admin.site.register(deptvision) admin.site.register(deptstaff) admin.site.register(deptplace) admin.site.register(depgallery) admin.site.register(deptcontact) create the folder templates and create the html files.
  • 36. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 36 Base.html <html> <head> <link rel="stylesheet" href=" https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css "> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css"> </head> <body> <nav class="navbar bg-dark navbar-expand-md "> <div class="container"> <h3 class="text-white"> Department of Computer Hardware Engineering </h3> </div> <div class="collapse navbar-collapse justify-content-center "> <ul class="navbar-nav justify-content-center fw-bold"> <li class="nav-item active"> <a class="nav-link text-white" href="{% url 'homes' %}">Home </a> </li> <li class="nav-item"> <a class="nav-link text-white" href="{% url 'vision' %}">Vision&Mission</a> </li> <li class="nav-item"> <a class="nav-link text-white" href="{% url 'staff' %}">People</a> </li> <li class="nav-item"> <a class="nav-link text-white" href="{% url 'placement' %}">Placements</a> </li> <li class="nav-item"> <a class="nav-link text-white" href="{% url 'gallery' %}">Gallery</a> </li> <li class="nav-item"> <a class="nav-link text-white" href="{% url 'contact' %}">Contact</a>
  • 37. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 37 </li> </ul> </div> </div> </nav> {% block content %} {% endblock %} <section class="fixed-bottom"> <footer class="pt-2 pb-2 bg-dark text-light"> <div class="container"> <div class="row align-items-center"> <center><h4>Government Polytechnic College Nedumkandam</h4><center> </div> </div> </footer> </section> </body> </html> Home.html {% extends 'base.html' %} {% block content %} <body style="background-color:#DAD6D5;"> <div class="mx-auto bg-secondary text-justify text-light p-4 my-4 w-75 border rounded"> {% for d in dept%} <h1><center>{{d.dep_name}}</h1></center> <center><img src="{{d.dep_image}}"</center>> <p>{{d.dep_description}}</p> </div> {% endfor %} </body> {% endblock %}
  • 38. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 38 Staff.html {% extends 'base.html' %} {% block content %} <body style="background-color:#DAD6D5;"> <div class="container bg-dark text-center my-4"> {% for d in staffs%} <div class="card my-4 mx-3 text-center" style="width: 14rem; display:inline- block"> <img src="{{d.staff_image}}..." class="card-img-top" alt="..."> <div class="card-body"> <center><h5 class="card-title">{{d.staff_name}}</h5> <p class="card-text">{{d.staff_description}}</p></center> </div> </div> {% endfor %} </div> </body> {% endblock %} Vision.html {% extends 'base.html' %} {% block content %} <body style="background-color:#DAD6D5;"> {% for d in vis%} <div class="mx-auto bg-secondary text-justify text-light p-4 my-4 w-75 border rounded"> <center><img src="{{d.vis_image}}"height="90" width="90"></center> <p><h5>{{d.vis_description}}<h5></p> </div> {% endfor %} </body> {% endblock %}
  • 39. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 39 Placement.html {% extends 'base.html' %} {% block content %} <body style="background-color:#DAD6D5;"> <div class="container bg-dark text-center my-1 text-white"> <h3> Placements Got in 2022</h3> <br><h4>Congratulations</h4> {% for d in place%} <div class="card my-1 mx-3 text-center" style="width: 14rem; display:inline- block"> <img src="{{d.place_image}}..." class="card-img-top" alt="..."> <div class="card-body text-dark"> <center><h5 class="card-title">{{d.place_name}}</h5> <p class="card-text">{{d.place_description}}</p></center> </div> </div> {% endfor %} </div> </body> {% endblock %} Gallery.html {% extends 'base.html' %} {% block content %} <body style="background-color:#DAD6D5;"> <div class="container bg-dark text-center my-4"> {% for d in gal%} <div class="card my-4 mx-3 text-center" style="width: 14rem; display:inline- block"> <img src="{{d.gal_image}}..." class="card-img-top" alt="..." height="150" width="50"> <div class="card-body"> <center><h5 class="card-title">{{d.gal_name}}</h5>
  • 40. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 40 </div> </div> {% endfor %} </div> </body> {% endblock %} Contact.html {% extends 'base.html' %} {% block content %} <body style="background-color:#DAD6D5;"> <div class="mx-auto bg-dark text-justify text-light p-4 my-4 w-75 border rounded"> {% for d in cont%} <h2>{{d.cont_name}}</h2> <h4>{{d.cont_address}}</h4> <h4>{{d.cont_email}}</h4> <h4>{{d.cont_phone}}</h4> </div> {% endfor %} <br><br><br><br> <center><h5>Designed by<br> Sreekanth M G <Br>GPTC Nedumkandam<br>Mob:9497761221<h5><center> </body> {% endblock %} Run the development server
  • 41. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 41
  • 42. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 42
  • 43. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 43 We can manage the data in the website by using admin panel. Create a superuser python manage.py createsuperuser Then enter the Username of your choice and press enter. Username: srishti Then enter the Email address and press enter.(It can be left blank) Email address: example@gmail.com Next, enter the Password in-front of the Password field and press enter.Enter a strong password so as to keep it secure. Password: ****** Then again enter the same Password for confirmation. Password(again): ****** Superuser created successfully if above fields are entered correctly. Enter the URL http://127.0.0.1:8000/admin in browser
  • 44. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 44 Enter the username and password Then the admin panel appears. Here we can see all the models that we create
  • 45. Application Development Lab S4 CT Prepared By Sreekanth M G ,GPTC Nedumkandam Page. 45 We can add data to any models by using add button RESULT: Successfully created the web site of department.