IT 5th Semester Full Stack Web Development Lab - IT3511 - Lab Manual
IT 5th Semester Full Stack Web Development Lab - IT3511 - Lab Manual
Environmental Sciences
Professional English and Sustainability -
Professional English - - II - HS3252 Discrete Mathematics - GE3451
I - HS3152 MA3354
Statistics and Theory of Computation
Matrices and Calculus Numerical Methods - Digital Principles and - CS3452
3rd Semester
4th Semester
- MA3151 MA3251 Computer Organization
1st Semester
2nd Semester
Computer Networks -
CS3591
Object Oriented
Full Stack Web Software Engineering - Human Values and
5th Semester
8th Semester
6th Semester
Elective 1 Elective-5
Management Elective
Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering
lOMoARcPSD|45374298
www.BrainKart.com
R - 2021
Name :
Register Number :
Year/Semester : III / V
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
BONAFIDE CERTIFICATE
This is to certify that this is the Bonafide Record of work done by Mr.
/Ms.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . …
Submitted for the Anna University B.Tech Practical Examination held on.
.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
9
Develop a program to create and build a password strength check
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Date:
Aim: To develop a full stack personal portfolio web application that uses python django
framework
Procedure:
Now application structure will look like below image project structure
The models.py file contains code for database design using django object relational
mapper(ORM)
After models creation use python manage.py makemigrations and python manage.py
migrate for table creations
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
In views.py the business logics will take place template folder contain all html file and
all static files placed inside static folder
1.Home.html:
{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="container">
<div class="animated">
Hey, I'm<br>
</div>
</div>
</div>
</a>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
</a>
</a>
</a>
</a>
</div>
{% include 'nav.html' %}
</div>
</div>
<span class="scroll__mouse">
<span class="scroll__wheel"></span>
</span>
</a>
{% include 'experiences_and_education.html' %}
{% include 'languages_and_tools.html' %}
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
{% include 'projects.html' %}
{% include 'about_and_contact.html'%}
</div>
{% endblock content %}
Backend (model.py):
import re
class Information(models.Model):
# Social Network
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
def __str__(self):
return self.name_complete
class Competence(models.Model):
def __str__(self):
return self.title
class Education(models.Model):
def __str__(self):
return self.title
class Experience(models.Model):
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
def __str__(self):
return self.title
class Project(models.Model):
demo = models.URLField()
github = models.URLField()
show_in_slider = models.BooleanField(default=False)
def __str__(self):
return self.title
def get_project_absolute_url(self):
return "/projects/{}".format(self.slug)
self.slug = self.slug_generate()
def slug_generate(self):
slug = self.title.strip()
return slug.lower()
class Message(models.Model):
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
send_time = models.DateTimeField(auto_now_add=True)
is_read = models.BooleanField(default=False)
def __str__(self):
return self.name
Business Logic(views.py)
import json
Competence,
Education,
Experience,
Project,
Information,
Message
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
def email_send(data):
old_message = Message.objects.last()
return False
email_from = settings.EMAIL_HOST_USER
recipient_list = [settings.EMAIL_HOST_USER, ]
return True
def homePage(request):
template_name = 'homePage.html'
context = {}
if request.method == 'POST':
if request.POST.get('rechaptcha', None):
form = MessageForm(request.POST)
if form.is_valid():
form.save(commit=False)
data = {
'name': request.POST['name'],
'email': request.POST['email'],
'message': request.POST['message']
if email_send(data):
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
form.save()
else:
return JsonResponse({'success': False, 'errors': "Oops, you have to check the recaptcha !"})
if request.method == 'GET':
form = MessageForm()
competences = Competence.objects.all().order_by('id')
education = Education.objects.all().order_by('-id')
experiences = Experience.objects.all().order_by('-id')
projects = Project.objects.filter(show_in_slider=True).order_by('-id')
info = Information.objects.first()
context = {
'info': info,
'competences': competences,
'education': education,
'experiences': experiences,
'projects': projects,
'form': form,
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Output:
Homepage:
About:
Projects:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Contact:
RESULT:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Date:
Aim: To create full stack TODO application with users authentication and Updation
Procedure:
The models.py file contains code for database design using django object relational
mapper(ORM)
After models creation use python manage.py makemigrations and python manage.py
migrate for table creations
In views.py the business logics will take place template folder contain all html file and
all static files placed inside static folder
Index.html:
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TODO APP</title>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<body>
<nav class="navbar">
<p class="navbar-brand">TODO APP</p>
{% if user.is_authenticated %}
<p id="welcome-user">Welcome, {{ request.user.username }}</p>
<ul>
<li class="navbar-item">
<a class="link" href="{% url 'logout' %}">Logout</a>
</li>
</ul>
{% else %}
<ul>
{% if request.path == '/register/' %}
<li>
<a class="link" href="{% url 'login' %}">Login</a>
</li>
{% elif request.path == '/login/' %}
<li>
<a class="link" href="{% url 'register' %}">Register</a>
</li>
{% endif %}
</ul>
{% endif %}
</nav>
{% block content %}
{% endblock %}
<!-- Below jquery javascript is required for modal functionalities -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<!—
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script
> -->
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>
Login.html
{% extends 'todo/index.html' %}
{% load crispy_forms_tags %}
{% block content %}
<div class="content-section">
<form action="" method="POST">
{% csrf_token %}
<fieldset class="form-group">
<legend>Login</legend>
<hr>
{{ form | crispy }}
</fieldset>
<div class="form-submit">
<button class="login-submit-btn" type="submit">Login</button>
</div>
<hr>
<div id="create-account">
<medium class="text-muted">
Don't Have an Account?
<a href="{% url 'register' %}" class="register-link">Sign Up</a>
</medium>
</div>
</form>
</div>
{% endblock %}
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
register.html
{% extends 'todo/index.html' %}
{% load crispy_forms_tags %}
{% block content %}
<div class="register-content">
<form action="" method="POST">
{% csrf_token %}
<fieldset class="register-form-group">
<legend>Register</legend>
<hr>
{{ form | crispy }}
</fieldset>
<div class="form-submit">
<button class="btn btn-success" type="submit">Sign Up</button>
</div>
<hr>
<div class="login-account">
<medium class="text-muted">
Already Have an Account?
<a href="{% url 'login' %}" class="login-link">Login</a>
</medium>
</div>
</form>
</div>
{% endblock %}
Backend(models.py):
class TodoItem(models.Model):
"""
"""
name = models.CharField(max_length=100)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
created_on = models.DateTimeField(auto_now_add=True)
updated_on = models.DateTimeField(auto_now=True)
is_completed = models.BooleanField(default=False)
related_name="todo_item")
class Meta:
"""
Meta Information
"""
app_label = "todo"
db_table = "todo_item"
verbose_name = "todo_item"
verbose_name_plural = "todo_items"
def __str__(self):
return self.name
views.py:
login_required
def home(request):
"""
"""
if request.method == 'POST':
todo_name = request.POST.get("new-todo")
return redirect("home")
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
# todo items
paginator = Paginator(todos, 4)
page_number = request.GET.get("page")
page_obj = paginator.get_page(page_number)
# NOTE: Need to change the html file to crud.html for displaying the todo's
def register(request):
"""
Args:
"""
form = UserRegistrationForm()
if request.method == "POST":
form = UserRegistrationForm(request.POST)
if form.is_valid():
form.save()
return redirect("login")
else:
form = UserRegistrationForm()
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Output:
Register:
Login:
Add page:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Update:
RESULT:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
DATE:
Aim: To create a simple micro blogging application with user post and follower comments on
post
Procedure:
The models.py file contains code for database design using django object relational
mapper(ORM)
After models creation use python manage.py makemigrations and python manage.py
migrate for table creations
In views.py the business logics will take place template folder contain all html file and
all static files placed inside static folder
Frontend:
Bloghome.html
{% extends 'base.html' %}
{% load static %}
{% block content %}
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<div class="container">
<div class="row">
<div class="col-lg-7">
</div>
</div>
</section>
<section class="intro">
<div class="container">
<div class="row">
<div class="col-lg-8">
</div>
</div>
</div>
</section>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<div class="container">
<!-- Post-->
{% if forloop.counter < 5 %}
{% endif %}
<div class="content">
<header class="post-header">
<div class="category">
<a href="#">{{cat}}</a>
{% endfor %}
</div>
<h2 class="h4">{{obj.title}}</h2></a>
</header>
<p>{{obj.overview}}</p>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<div class="title"><span>{{obj.author}}</span></div></a>
<div class="comments">
</footer>
</div>
</div>
</div>
{% if forloop.first or forloop.last %}
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
</section>
<div class="container">
<div class="row">
<div class="col-md-7">
<h2>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua</h2><a href="#" class="hero-link">View More</a>
</div>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
</div>
</div>
</section>
<section class="latest-posts">
<div class="container">
<header>
<p class="text-big">.</p>
</header>
<div class="row">
<div class="post-details">
<div class="date">{{obj.timestamp}}</div>
<div class="category">
<a href="#">{{cat}}</a>
{% endfor %}
</div>
<h3 class="h4">{{obj.title}}</h3></a>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<p class="text-muted">{{obj.content}}</p>
</div>
</div>
{% endfor %}
</div>
</div>
</section>
<div class="row">
</div>
</div>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
</div>
</div>
</div>
</section>
{% endblock content %}
Database(models.py):
class Category(models.Model):
title = models.CharField(max_length=30)
def __str__(self):
return self.title
class Comment(models.Model):
timestamp = models.DateTimeField(auto_now_add=True)
content =tinymce_models.HTMLField('Content')
post = models.ForeignKey(
def __str__(self):
return self.user.username
class account(models.Model):
email_id=models.CharField("email id",max_length=100)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
password=models.CharField("user password",max_length=100)
def __str__(self):
return self.name;
class Post(models.Model):
title = models.CharField(max_length=100)
overview = models.TextField()
timestamp = models.DateTimeField(auto_now_add=True)
content =models.TextField(max_length=10000)
# comment_count = models.IntegerField(default = 0)
# view_count = models.IntegerField(default = 0)
thumbnail = models.ImageField()
categories = models.ManyToManyField(Category)
features = models.BooleanField()
previous_post = models.ForeignKey(
next_post = models.ForeignKey(
location=models.CharField(max_length=10000,null=True)
phone=models.CharField(max_length=1000)
timing=models.CharField(max_length=100)
address=models.CharField(max_length=1000)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
views.py:
def index(request):
featured = Post.objects.all()
latest = Post.objects.order_by('-timestamp')[0:3]
if request.method == "POST":
email = request.POST["email"]
new_signup = Signup()
new_signup.email = email
new_signup.save()
context = {
'object_list' : featured,
'latest': latest
def blog(request):
category_count = get_category_count()
most_recent = Post.objects.order_by('-timestamp')[:3]
post_list = Post.objects.all()
paginator = Paginator(post_list, 4)
page_request_var = 'page'
page = request.GET.get(page_request_var)
try:
paginated_queryset = paginator.page(page)
except PageNotAnInteger:
paginated_queryset = paginator.page(1)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
except EmptyPage:
paginated_queryset = paginator.page(paginator.num_pages)
context = {
'queryset' : paginated_queryset,
'most_recent': most_recent,
'page_request_var': page_request_var,
'category_count': category_count
Outome:
Home:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Blog Post:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Post comments:
RESULT:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Ex. No: 4 Create a food delivery website where users can order food from a
particular restaurant listed in the website.
Aim:To Create Full functional Food ordering application with users can select food and make
order online
Procedure:
The models.py file contains code for database design using django object relational
mapper(ORM)
After models creation use python manage.py makemigrations and python manage.py
migrate for table creations
In views.py the business logics will take place template folder contain all html file and
all static files placed inside static folder
Frontend code:
Home.html:
<!DOCTYPE html>
<head>
{% load static %}
<meta charset="utf-8">
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<link href="https://fonts.googleapis.com/css?family=Caveat:700&display=swap"
rel="stylesheet">
<link
href="https://fonts.googleapis.com/css?family=Poppins:300,300i,400,400i,500,500i,600,600i,70
0,700i" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Caveat:400,700&subset=cyrillic"
rel="stylesheet">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-
Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384-
Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-
wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
<title>foodApp | Home</title>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
</head>
<span class="navbar-toggler-icon"></span>
</button>
</li>
</li>
{% endif %}
<div class="dropdown-divider"></div>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<div class="dropdown-divider"></div>
{% endif %}
</div>
</li>
{% endif %}
</ul>
</div>
</nav>
</body>
</html>
Database(models.py):
lass Food(models.Model)
FoodId = models.AutoField(primary_key=True)
FoodName = models.CharField(max_length=30)
FoodCat = models.CharField(max_length=30)
FoodPrice = models.FloatField(max_length=15)
FoodImage = models.ImageField(upload_to='media',default='')
class Meta:
db_table = "FP_Food"
class Cust(models.Model):
CustId = models.AutoField(primary_key=True)
CustFName = models.CharField(max_length=30)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
CustLName = models.CharField(max_length=30)
CustCont = models.CharField(max_length=10)
CustEmail = models.CharField(max_length=50)
CustPass = models.CharField(max_length=60)
Address = models.CharField(max_length=150,default='')
class Meta:
db_table = "FP_Cust"
views.py:
def addfood(request):
if request.method=="POST":
form = FoodForm(request.POST,request.FILES)
if form.is_valid():
try:
form.save()
return redirect("/allfood")
except:
return render(request,"error.html")
else :
form = FoodForm()
return render(request,'addfood.html',{'form':form})
def showfood(request):
foods = Food.objects.all()
return render(request,'foodlist.html',{'foodlist':foods})
def deletefood(request,FoodId):
foods = Food.objects.get(FoodId=FoodId)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
foods.delete()
return redirect("/allfood")
def getfood(request,FoodId):
foods = Food.objects.get(FoodId=FoodId)
return render(request,'updatefood.html',{'f':foods})
def updatefood(request,FoodId):
foods = Food.objects.get(FoodId=FoodId)
form = FoodForm(request.POST,request.FILES,instance=foods)
if form.is_valid():
form.save()
return redirect("/allfood")
return render(request,'updatefood.html',{'f':foods})
def addcust(request):
if request.method=="POST":
form = CustForm(request.POST)
if form.is_valid():
try:
form.save()
return redirect("/login")
except:
return render(request,"error.html")
else :
form = CustForm()
return render(request,'addcust.html',{'form':form})
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Output:
Home
Menu page:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Cart:
Invoice:
RESULT:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Aim: To create a full stack we application where user can sell their products and can purchase
the products online
Procedure:
The models.py file contains code for database design using django object relational
mapper(ORM)
After models creation use python manage.py makemigrations and python manage.py
migrate for table creations
In views.py the business logics will take place template folder contain all html file and
all static files placed inside static folder
Frontend code:
Base.html:
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<meta charset="utf-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-
Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
</head>
<body>
<span class="navbar-toggler-icon"></span>
</button>
</li>
{% if user.is_authenticated %}
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
{% else %}
{% endif %}
</ul>
</div>
</nav>
<div class="container">
{% if messages %}
{{ message }}
{% endfor%}
{% endif %}
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
integrity="sha384Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxM
fooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8
ifwB6" crossorigin="anonymous"></script>
</body>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Home.html
{% extends "store/base.html" %}
{% block content %}
<hr class="style1">
{% if product.image1 %}
{% endif %}
{% if product.image2 %}
{% endif %}
<hr>
{% endfor %}
{% endblock content %}
Database(models.py):
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
class Product(models.Model):
name = models.CharField(max_length=30)
description = models.TextField()
age = models.FloatField()
cost = models.PositiveIntegerField()
address = models.CharField(max_length=100)
def __str__(self):
return self.name
#function to return url string for displaying product after its creation
def get_absolute_url(self):
Views.py:
ef home(request):
context = {
'products' : Product.objects.all()
class ProductListView(ListView):
model = Product
template_name = 'store/home.html'
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
context_object_name = 'products'
class ProductDetailView(DetailView):
model = Product
"""Class based view for creating a new Product with login required mixin"""
model = Product
form.instance.seller = self.request.user
return super().form_valid(form)
"""Class based view for updating a Product with login required mixin"""
model = Product
form.instance.seller = self.request.user
return super().form_valid(form)
# function for testing if user tying to udpate the product is seller itself
def test_func(self):
product = self.get_object()
if self.request.user == product.seller:
return True
return False
model = Product
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
# function for testing if user tying to delete the product is seller itself
def test_func(self):
product = self.get_object()
if self.request.user == product.seller:
return True
return False
@login_required
user = request.user
buyerInstance = User.objects.get(username=request.user.username)
sellerInstance = User.objects.get(username=product.seller.username)
if user == product.seller:
return redirect('home')
user.profile.wallet -= product.cost
product.seller.profile.wallet += product.cost
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
user.save()
product.seller.save()
product.delete()
else:
return redirect('home')
OutPut:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Wallet:
Listed products:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
BuyPage:
RESULT:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Aim:To develop a employee leave management and approval system with tracking management
using python django framework
Procedure:
The models.py file contains code for database design using django object relational
mapper(ORM)
After models creation use python manage.py makemigrations and python manage.py
migrate for table creations
In views.py the business logics will take place template folder contain all html file and
all static files placed inside static folder
Frontend code:
Index.html:
{% load static %}
<!doctype html>
<html lang="en">
<head>
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
<title>Leave Management</title>
</head>
<body>
<style type="text/css">
body{
position: relative;
background: #243177;
a{
font-variant: petite-caps;
font-weight: 100;
font-size: 16px;
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
navbar-brand{
font-variant: petite-caps;
font-weight: 600;
font-size: 3.1rem;
color: #e4a530;
h2{
color: gold;
font-size: 4.9rem;
p{
font-variant: small-caps;
color: #cecece;
p span{
color: #a5a5a5;
font-weight: bold;
span.icon{
font-size: 15px;
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
.content{
position: relative;
height: 100vh;
.sub-title{
vertical-align: -webkit-baseline-middle;
.back-link{
color: #fff;
font-size: 2.6rem;
font-weight: 900;
.back-link:hover{
color: #fff;
font-size: 2.8rem;
.container-centered-items{
position: absolute;
top: 50%;
left: 0;
right: 0;
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
</style>
<!--CONTENTS-->
<section class="content">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<span class="sr-only"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
{% if request.user.is_authenticated %}
{% else %}
{% endif %}
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
</ul>
</ul>
</nav>
<section class="row">
<section class="">
<div class="center-me-please"
</p>
</div>
</section>
</section>
</section>
</div>
<div>
{% if request.user.is_authenticated %}
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
{% endif %}
</div>
</body>
<script type="text/javascript">
</script>
</html>
Database(Models.py):
import datetime
class Role(models.Model):
name = models.CharField(max_length=125)
description = models.CharField(max_length=125,null=True,blank=True)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
created = models.DateTimeField(verbose_name=_('Created'),auto_now_add=True)
updated = models.DateTimeField(verbose_name=_('Updated'),auto_now=True)
class Meta:
verbose_name = _('Role')
verbose_name_plural = _('Roles')
ordering = ['name','created']
def __str__(self):
return self.name
class Department(models.Model):
name = models.CharField(max_length=125)
description = models.CharField(max_length=125,null=True,blank=True)
created = models.DateTimeField(verbose_name=_('Created'),auto_now_add=True)
updated = models.DateTimeField(verbose_name=_('Updated'),auto_now=True)
class Meta:
verbose_name = _('Department')
verbose_name_plural = _('Departments')
ordering = ['name','created']
def __str__(self):
return self.name
class Employee(models.Model):
MALE = 'male'
FEMALE = 'female'
OTHER = 'other'
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
GENDER = (
(MALE,'Male'),
(FEMALE,'Female'),
(OTHER,'Other'),
(NOT_KNOWN,'Not Known'),
MR = 'Mr'
MRS = 'Mrs'
MSS = 'Mss'
DR = 'Dr'
SIR = 'Sir'
MADAM = 'Madam'
TITLE = (
(MR,'Mr'),
(MRS,'Mrs'),
(MSS,'Mss'),
(DR,'Dr'),
(SIR,'Sir'),
(MADAM,'Madam'),
FULL_TIME = 'Full-Time'
PART_TIME = 'Part-Time'
CONTRACT = 'Contract'
INTERN = 'Intern'
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
EMPLOYEETYPE = (
(FULL_TIME,'Full-Time'),
(PART_TIME,'Part-Time'),
(CONTRACT,'Contract'),
(INTERN,'Intern'),
# PERSONAL DATA
user = models.ForeignKey(User,on_delete=models.CASCADE,default=1)
image = models.FileField(_('Profile
Image'),upload_to='profiles',default='default.png',blank=True,null=True,help_text='upload
image size less than 2.0MB')#work on path username-date/image
firstname = models.CharField(_('Firstname'),max_length=125,null=False,blank=False)
lastname = models.CharField(_('Lastname'),max_length=125,null=False,blank=False)
othername = models.CharField(_('Othername
(optional)'),max_length=125,null=True,blank=True)
birthday = models.DateField(_('Birthday'),blank=False,null=False)
department = models.ForeignKey(Department,verbose_name
=_('Department'),on_delete=models.SET_NULL,null=True,default=None)
role = models.ForeignKey(Role,verbose_name
=_('Role'),on_delete=models.SET_NULL,null=True,default=None)
employeetype = models.CharField(_('Employee
Type'),max_length=15,default=FULL_TIME,choices=EMPLOYEETYPE,blank=False,null=Tru
e)
employeeid = models.CharField(_('Employee ID
Number'),max_length=10,null=True,blank=True)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
# app related
created = models.DateTimeField(verbose_name=_('Created'),auto_now_add=True,null=True)
updated = models.DateTimeField(verbose_name=_('Updated'),auto_now=True,null=True)
#PLUG MANAGERS
objects = EmployeeManager()
class Meta:
verbose_name = _('Employee')
verbose_name_plural = _('Employees')
ordering = ['-created']
def __str__(self):
return self.get_full_name
@property
def get_full_name(self):
fullname = ''
firstname = self.firstname
lastname = self.lastname
othername = self.othername
return fullname
elif othername:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
return fullname
return
@property
def get_age(self):
current_year = datetime.date.today().year
dateofbirth_year = self.birthday.year
if dateofbirth_year:
return
@property
def can_apply_leave(self):
pass
def save(self,*args,**kwargs):
'''
overriding the save method - for every instance that calls the save method
'''
data = code_format(get_id)
self.employeeid = data #pass the new code to the employee_id as its orifinal or actual code
# print(self.employeeid)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Views.py
ef dashboard_employees(request):
return redirect('/')
dataset = dict()
departments = Department.objects.all()
employees = Employee.objects.all()
#pagination
query = request.GET.get('search')
if query:
employees = employees.filter(
Q(firstname__icontains = query) |
Q(lastname__icontains = query)
page = request.GET.get('page')
employees_paginated = paginator.get_page(page)
blocked_employees = Employee.objects.all_blocked_employees()
return render(request,'dashboard/employee_app.html',dataset)
def dashboard_employees_create(request):
return redirect('/')
if request.method == 'POST':
form = EmployeeCreateForm(request.POST,request.FILES)
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
if form.is_valid():
user = request.POST.get('user')
instance.user = assigned_user
instance.title = request.POST.get('title')
instance.image = request.FILES.get('image')
instance.firstname = request.POST.get('firstname')
instance.lastname = request.POST.get('lastname')
instance.othername = request.POST.get('othername')
instance.birthday = request.POST.get('birthday')
Output:
HR Page:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Add employee:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
lOMoARcPSD|45374298
www.BrainKart.com
Pending leaves:
Approve leaves:
RESULT:
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes
Click on Subject/Paper under Semester to enter.
Environmental Sciences
Professional English and Sustainability -
Professional English - - II - HS3252 Discrete Mathematics - GE3451
I - HS3152 MA3354
Statistics and Theory of Computation
Matrices and Calculus Numerical Methods - Digital Principles and - CS3452
3rd Semester
4th Semester
- MA3151 MA3251 Computer Organization
1st Semester
2nd Semester
Computer Networks -
CS3591
Object Oriented
Full Stack Web Software Engineering - Human Values and
5th Semester
8th Semester
6th Semester
Elective 1 Elective-5
Management Elective
Elective-6
Elective 2
All Computer Engg Subjects - [ B.E., M.E., ] (Click on Subjects to enter)
Programming in C Computer Networks Operating Systems
Programming and Data Programming and Data Problem Solving and Python
Structures I Structure II Programming
Database Management Systems Computer Architecture Analog and Digital
Communication
Design and Analysis of Microprocessors and Object Oriented Analysis
Algorithms Microcontrollers and Design
Software Engineering Discrete Mathematics Internet Programming
Theory of Computation Computer Graphics Distributed Systems
Mobile Computing Compiler Design Digital Signal Processing
Artificial Intelligence Software Testing Grid and Cloud Computing
Data Ware Housing and Data Cryptography and Resource Management
Mining Network Security Techniques
Service Oriented Architecture Embedded and Real Time Multi - Core Architectures
Systems and Programming
Probability and Queueing Theory Physics for Information Transforms and Partial
Science Differential Equations
Technical English Engineering Physics Engineering Chemistry
Engineering Graphics Total Quality Professional Ethics in
Management Engineering
Basic Electrical and Electronics Problem Solving and Environmental Science and
and Measurement Engineering Python Programming Engineering