You are on page 1of 41

GYM MANAGEMENT SYSTEM

MINOR PROJECT REPORT


Submitted by
AUGXY MOON S.M
19BCM007
Under the Guidance of
Mrs.Hemalatha.R Msc MPhil
Assistant Professor
Department of Computer Science
In partial fulfillment of the requirements for the award of the degree of
BACHELOR OF SCIENCE IN COMPUTER SCIENCE
of Bharathiar University

DEPARTMENT OF COMPUTER SCIENCE


PSG COLLEGE OF ARTS & SCIENCE
An Autonomous College-Affiliated to Bharathiar University
Accredited with ‘A’ grade by NAAC (3rd Cycle)
College with Potential for Excellence
(Status Awarded by the UGC)
Star College Status Awarded by DBT - MST
An ISO 9001:2015 Certified Institution
Coimbatore -641 014
November 20
ACKNOWLEDGEMENT

My venture stands imperfect without dedicating my gratitude to a few people who have
contributed a lot towards the victorious completion for my project work.

I would like to thank Mr. L. Gopalakrishnan, Managing Trustee, PSG & Sons
Charities, for providing me prospect and surroundings that made the work possible.

I take this opportunity to express my deep sense of gratitude to Dr. T. Kannaian,


Secretary of PSG College of Arts and Science, Coimbatore for permitting and doing the
needful towards the successful completion of this project.

I express my deep sense of gratitude and sincere thanks to our Principal


Dr. D. Brindha MSc, MPhil, PhD MA(Yoga) for her valuable advice and concern on
students.

I am very thankful to Dr. A Anguraj, MSc, MPhil, PhD, Vice Principal,Prof. M.


Umarani, MCom, MPhil, Faculty-In-Charge (Student Affairs)for their support.

I kindly and sincerely thank Dr. T Revathi MCA, MPhil, PhD, Associate Professor and
Head, Department of Computer Science for her whole hearted help to complete this
project successfully by giving valuable suggestions.

I convey my heartiest and passionate sense of thankfulness to my project guide


Mrs.Hemalatha.R Msc MPhil Assistant Professor, Department of Computer Science, for
his timely suggestion which had enable me in completing the project successfully.

This note of acknowledgement will be incomplete without paying my heartfelt devotion to


my parents, my friends and other people, for their blessings, encouragement, financial
support and the patience, without which it would have been impossible for me to complete
the job.
SYNOPSIS

Gym Management System serves the purpose of managing a gym. An overall control of the
gym is provided by this system. The admin can monitor all the activities and keep record of
every stuff in the gym. This helps the admin to reduce more paperwork and able to manage
an organization easily with the help of digitalized records. This project shall enable the user
to add members to a gym and manage the fee payment of the gym user. It is a very simple
interface developed using Django framework. The project consists of two sections. One is for
the outside users who wants to enroll in the gym or the members who are already enrolled.
They can buy new membership and pay fees using this web application. It can be hosted on
the internet so that user from all around the world anytime anywhere can use the system to
pay their fees. The other section is the admin section in which the gym admin has the overall
control of the gym. The admin section holds all the details of gym members. It shall enable
the user to make payments monthly, quarterly or annually. The records and payment details
are stored in database. This database is created using Sqlite3. The admin can view, create,
update and delete these records. This data in the admin section is secured using username and
password. The admin needs to enter the credentials every time he logs in. Only one user can
login so therefore there is no other user who can access the admin section. When the admin
login using his credentials, he is redirected to admin dashboard after the successful login. The
admin dashboard contains all changes made and new user enrollment, fee payment and
enquiries related to the gym. The user interface of the web application is developed using
html and css which provides an elegant design to the application. The most popular python
framework Django is used to design the whole web application which is more secure and
reliable in terms of data security. So, there is no risk of data breach in the future.
TABLE OF CONTENTS
CONTENTS PAGE NO.
1. INTRODUCTION

1.1. Project Overview 1


1.2. Modules and Description 2

2. SYSTEM SPECIFICATION

2.1. Hardware Specification 3


2.2. Software Specification 3

3. EXISTING SYSTEM 4

4. PROPOSED SYSTEM 4

5. SYSTEM DESIGN

5.1. ER Diagram 5
5.2. Data Flow Diagram 7
5.3. Database Design 9
5.4. Input Design 12
5.5. Output Design 14

6. SYSTEM TESTING AND IMPLEMENTATION 16

7. SCOPE FOR FUTURE ENHANCEMENTS 18

8. CONCLUSION 19
BIBLIOGRAPHY 20

APPENDICES
A. SCREEN SHOTS 21
B. SAMPLE CODING 28
1. INTRODUCTION
1.1 OVERVIEW OF THE PROJECT:

The concept of Gym Management System is to have a website for the internet audience and
also management application for a gym owner. As for the internet audience the webpage
provides features and service provided by the gym. If one of the users or any other wish to
join the gym they can easily buy a membership from the plans provided by the gym which is
officially stated in the website. After choosing the suitable plan user is redirected to payment.
In which he has to pay according to the plan he chose. As a result, he is given a member id
for joining the gym physically and transaction id for the reference of his payment. There is
also an option for fee payment for the members of the gym by specifying their member id. An
enquiry form is provided for the users to enquire about the gym which is directly send to the
gym admin. Then a single-user log in is available only for the admin. The log in details of the
admin is given by the server admin. After the admin logins, he has all the data and
information, all member records, equipment records, fee and payment information. These
data are organized and easily accessible for the admin from his dashboard. The admin can
create update and delete all the records. He has the overall control of the gym. The Gym
management system provides an easy management of gym using computer and internet.

1
1.2 MODULES AND DESCRIPTION:

The system is proposed to have the following modules:

-User Module

-Trainer Module

-Equipment Module

-Member Module

-Payment Module

User Module:

Administrator: Server Admin has the total control of the Web Application. Server Admin
has access to all databases, information, logs and data.

Gym Admin: Gym Admin Module contains the user who has access to all the features to
manage the gym. This user has access to all data regarding gym members, equipment,
trainers, schedule etc.

Trainer Module: Trainers who train the members of the gym comes under this module.
Trainers are assigned to members. Trainers’ salary and other information are stored in the
databases which can be accessed by the gym admin.

Equipment Module: All Equipment in the gym and it’s details about the purchase and
warranty. Admin can view these details and can manage them accordingly.

Member Module: Membership Module contains details of the members who are enrolled in
the gym. This module contains the information of the members. This information is only
accessible by the gym admin.

Enquiry Module: Enquiries made by the users and members comes under this module.

Payment Module: Members and the users who wish to enrolled in the gym, make payments.
These payments and its related information are in this module

2
2. SYSTEM SPECIFICATION

2.1 HARDWARE SPECIFICATION:

COMPONENTS REQUIREMENTS

PROCESSOR AMD PRO A4-4350B R4, 5 COMPUTE CORES


2C+3G 2.50 GHz
MONITOR LENOVO

RAM 4.00GB

2.2 SOFTWARE SPECIFICATION:

COMPONENTS REQUIREMENTS

OPERATING SYSTEM Windows 10


FRONTEND HTML, CSS
BACKEND DJANGO FRAMEWORK- PYTHON
DATABASE SQlite3

3
EXISTING SYSTEM

The existing system did not have a user-friendly interface. The details regarding gym
members were manually written and recorded. There was no system of paying fees online.
The gym members were not notified regarding the fee payment that were outstanding.
Disadvantage of Existing System:
 Data Security is very difficult
 File Based System can be misleading
 Difficulty to Gather information files
 Managing Records are difficult
 Admin cannot maintain records efficiently
 Chances of redundancy are High
 Data redundancy and inconsistency makes the existing system odd and inefficient

PROPOSED SYSTEM

This tool is basically developed to aid the gym admin to add members to the gym. It shall
help the user to know about fee payments. It has the option to select type of fee payments. It
could be monthly, quarterly or annually depending on the choice of the member. It also holds
the receipt number and the amount of fees paid. It shall also generate reports based on the
payment of fees.
Advantage of Proposed System:
 Gym Management System provides a computer-based management system for keeping
all records about members, machinery, expenses, transactions and salaries in an efficient
and accessible database.
 This system helps the admin and Admin to maintain large data about users and their daily
transactions in gym.
 It reduces and removes the manual and traditional workload; Administrator can easily
add/delete/update/view each record on the computer.
 Automated billing
 Easy Online Membership Sales and Engagement
 Payroll

4
5. SYSTEM DESIGN

5.1 ENTITY RELATIONSHIP DIAGRAM

An entity-relationship (ER) diagram is a specialized graphic that illustrates the


relationships between entities in a database. ER diagrams often use symbols to represent
three different types of information. An ERD is a conceptual and representational model
of data used to represent the entity framework infrastructure.
The elements of an ERD are:
 Entities
 Relationships
 Attributes

Attributes:

Entity:

Relationship:

5
ER DIAGRAM:

6
5.2 DATA FLOW DIAGRAM:
A data-flow diagram (DFD) is a graphical representation of the "flow" of data
through an information system. DFDs can also be used for the visualization of data
processing (structured design). On a DFD, data items flow from an external data
source or an internal datastore to an internal datastore or an external data sink via an
internal process. The purpose of a DFD is:

 To show the scope and boundaries of a system


 To show that the whole system has been considered
 May be used as a communications tool between a systems analyst and any person
who plays a part in the system
 To act as the starting point for redesigning a system

The circle represents the process. It shows the pair of the process that transforms input to
output.

The arrow represents the graphical flow into or out of a process

The store is used to model a collection of data packets at rest.

The terminator represents external entities with system communication.

7
DFD 0 LEVEL:

DFD 1 LEVEL:

8
5.3 DATABASE DESIGN:

Table Name: User


Primary Key: id

Field Name Data Type Size Constraints Description

Id Integer -- Primary Key Id of the user

first_name Varchar 50 Not Null First Name of the user


last_name Varchar 50 Not Null Last Name of the user
Email Varchar 100 Unique Email ID of the user
Username Varchar 25 Unique username for login
Password Varchar 25 Not Null password for login

Table Name: trainer


Primary Key: Id

Field Name Data Type Size Constraints Description

Id Integer -- Primary Key Id of the trainer

trainer_name Varchar 50 Not Null Name of the trainer


trainer_age Integer -- Not Null Age of the trainer
trainer_gender Varchar 10 Not Null Gender of the trainer
trainer_cell Integer 15 Unique Mobile No of trainer
aos Varchar 25 Not Null Area of Specialization
Salary Integer -- Not Null Salary of the trainer

9
Table Name: Equipment
Primary Key: Id

Field Name Data Type Size Constraints Description

Id Integer -- Primary Key Id of the equipment

eq_name Varchar 50 Not Null Name of the Equipment


units Integer -- Not Null No of Units
model_no Varchar 10 Unique Model Number
eq_type Varchar 25 Not Null Type of Equipment
price Integer -- Not Null Price
warranty Varchar 30 Not Null Warranty Period
date_of_pur Datetime -- Not Null Date of Purchase

Table Name: members


Primary Key: Id
Field Name Data Type Size Constraints Description

Id Integer -- Primary Key Id of the member

full_name Varchar 50 Not Null Full Name of the User


gender Varchar 6 Not Null Gender of the Member
age Integer -- Not Null Age of the Member
cell_no Integer -- Unique Phone Number of the Member
born_date Datetime -- Not Null Date of Birth
email Varchar 50 Unique Email of the Member
plan Varchar 10 Not Null Subscription Plan
date_joined Datetime -- Not Null Joined Date of the Member

10
Table Name: Payment
Primary Key: trans_id
Foreign Key: member

Field Name Data Type Size Constraints Description

trans_id Varchar 30 Primary Key Transaction ID


member Varchar 50 Foreign Key Name of the Member

paid_status Bool -- Not Null Payment Status


pay_mode Varchar 10 Not Null Mode of Payment
paid_date Datetime -- Not Null Paid Date
due_date Date -- Not Null Due Date
amt Integer -- Not Null Amount Paid

11
5.4 INPUT DESIGN

Input design is the process of converting user-originated inputs to a computer understandable


format. Input design is one of the most expensive phases of the operation of computerized
system and is often the major problem of a system. The system takes input from the users,
processes it and produces an output. Input design is linked that ties the information system
into the world of its users. The system should be user-friendly to gain appropriate information
to the user. This input provided by the user is processed and stored in the database.

12
13
5.5 OUTPUT DESIGN

Output design generally refers to the results and information that are generated by the system
for many end-users; it should be understandable with the enhanced format. When designing
output, system analysis accomplishes more things like, to determine what applications,
websites or documents whether blocked or allowed. As the outputs are the most important
sources of information to the users, better design should improve the system’s relationships
with others and also will help in decision-making.

14
15
6. SYSTEM TESTING AND IMPLEMENTATION
6.1 SYSTEM TESTING:

Testing of the software as a mean of accessing or measuring the software to determine


its quality. The area of testing is one of the key process areas in ensuring the quality of the
software known as Software Quality Assurance (SQA). Testing is done with one primary
objective to ensure the quality of the software before it is actually implemented. The main
purpose of testing from developer’s point of view is to gain confidence. If no errors are found
at least he is sure that the project under development is meeting it required goals in terms of
quality.

There is no way to find when to stop testing however people have followed
certain norms and guidelines over the course of time. They are as follows:

 When the rate of finding errors has reached an acceptable level.

 Based on the size of the system, “enough” errors have been found where
“enough” can be a quantitative parameter based on historical data.

 Measuring coverage of testing as percentage of line executed divided by total


number of lines in the system. If the percentage id below acceptable limits, then
the test plans have to be enhanced to test areas where code not been tested.

System Testing involves testing the software code for following

 Testing the fully integrated applications including external peripherals in order to


check how components interact with one another and with the system as a whole.
This is also called End to End testing scenario.
 Verify thorough testing of every input in the application to check for desired outputs.
 Testing of the user's experience with the application.

That is a very basic description of what is involved in system testing. You need to build
detailed test cases and test suites that test each aspect of the application as seen from the
outside without looking at the actual source code.

Types of Testing:

 Unit testing

16
 Integration testing
 System testing

Unit Testing:
Unit testing performed on each module or block of code during development. It is normally
done by the programmer who writes the code.

Integration Testing:
Integration testing done before, during and after integration of a new module into the
main software package. This involves testing of each individual code module. One piece of
software can contain several modules which are often created by several different
programmers. It is crucial to test each module's effect on the entire program model.

System Testing:
System testing done by a professional testing agent on the completed software product.

5.2 IMPLEMENTATION
System implementation is the important stage of protect where the theoretical design
is tuned into the practical system. The main stages in the implementation are as follows:
 Planning
 Training
 System testing and
 Changeover Planning
Planning is the first task in the system implementation. Planning means deciding on the
method and the time scale to be adopted. At the time of implementation of any system people
from different departments and system analysis involve they are confirmed to practical
problem of controlling various activities people outside their own data processing
departments. The line managers will be controlled through an implementation coordinating
committee. The committee considers ideas, problems and complaints of user department, it
must also consider
 The implication of system environment
 Self-selection and allocation implementation task
 Consultation with unions and resources available
 Standby facility and channels of communication

17
7. SCOPE FOR FUTURE ENHANCEMENTS
The system can have biometric feature to track the attendance of the members so that the
admin knows when a member enters the gym and exits. Automated messaging service can be
implemented for the members to remind them about due dates and other important events.
The present system is very useful for admin and the members but the trainers can’t do much
in the system. A portal for trainers can be added for managing their clients and schedule so
that they can keep everything organized.

18
7.CONCLUSION

The Gym Management System helps the admins to manage their gym efficiently. This
software enables the organization more reachable for the users. This software serves the users
who are not currently enrolled. This gives profit for the gym and it’s helpful for marketing
and advertising purpose. The user interface is friendly and the data in the system more secure
than ever. The interaction with the application is easy and elegant. The members of the gym
also have advantages which includes payment of fees and renewing their membership. The
workload of the admin is drastically reduced because of the online gym management system.
This has made a huge change in time and energy consumption when compared to the latter
system used. More time and energy are saved. The records are stored as digital format. No
paperwork is used. Retrieval of data of specific time is very much easy when compared to the
former system used. The web application is feature rich and user friendly. So the admin can
easily manage all data and information associated with the system.

19
BIBLIOGRAPHY

Reference Books:

 Django: Web Development with Python: by Arun Ravindran Samuel Dauzon


Aidas Bendoraitis(Author) ISBN : 1787121380

 Lightweight Django 1st Edition Julia Elman & Mark Lavin

 https://docs.djangoproject.com/en/3.2/

 https://www.w3schools.com/html/

 https://www.w3schools.com/css/

 Automate the Boring Stuff with Python: Practical Programming for Total
Beginners Book by AI Sweigart

20
APPENDICES

A. SCREENSHOTS
Home:

21
Plans:

22
New Membership - User

MEMBERSHIP SUCCESS:

23
Admin Login:

Admin Dashboard:

24
Members Details:

Add Equipment Page:

25
Enquiries Page

Fee and Payment Page:

26
New Membership: User

27
SAMPLE CODING:

index.html

<!DOCTYPE html>
<html>
<head>
{% load static %}
<meta charset="utf-8" name = "viewport" content="width=device-width,initial-
scale=1.0">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?
family=Poppins:wght@100;200;400;600&display=s wap" rel="stylesheet">
<link rel="shortcut icon" href="{% static 'images/icon.png' %}">
<title>AM FITNESS</title>
<link rel="stylesheet" href="{% static 'css/style.css' %}">
{% block css %} {% endblock %}
</head>
<body>
<section class="header">
<nav>
<a href="{% url 'gym:home'%}"><img src="{% static 'images/logo.png' %}"></a>
<div class="nav-links">
<ul>
{% if user.is_authenticated %}
<li><a href="{% url 'logout'%}">Log Out</a></li>
{% else %}
<li><a href="{% url 'gym:home'%}">Home</a></li>
<li><a href="{% url 'gym:payment'%}">Fee Payment</a></li>
<li><a href="{% url 'gym:plans'%}">Buy Membership</a></li>
<li><a href="{% url 'login'%}">Log In</a></li>
{% endif %}
</ul>
</nav>
<div class="text-box">
<h1>One Stop for Fitness</h1>
<p>
If you’re looking to join a supportive, welcoming gym community, with people of
all fitness levels who want to see you succeed,<br> you’ve come to the right place.
</p>

</div>
</section>
<! Plans >
<section class="plans">

28
<h1>Plans We Offer</h1>
<p>
We offer various plans for our customers.These plans are categorized as silver,gold
and platinum.
payments are done by online mode,
</p>
<div class="row">
<div class="plans-type">
<h3>Silver</h3>

<p>
Access to all strength equipments</br>Limited Workout Time</br>Diet
Plans<br>
</p>
</div>
<div class="plans-type">
<h3>Gold</h3>
<p>Access to all strength and cardio equipments<br>Two sessions a
day<br>Diet Plans<br>

</p>
</div>
<div class="plans-type">
<h3>Platinum</h3>
<p>Anytime Access<br>Personal Training<br>Yoga Classes<br>Special Diet
Plans
</p>
</div>

</div>
</section>
<section class="about">
<div>
<h1>Features</h1>
<p>You’re not just joining a gym. You’re joining a supportive community of like-
minded people who are here to give you the encouragement you need.</p>
</div>
<div class="row">
<div class="about-col">
<img src="{% static 'images/personanl training.png' %}">
<h3>Personal Training</h3>
<p>Personal training is provided by our specialized trainers for every Platinum
members</p>
</div>
<div class="about-col">
<img src="{% static 'images/yoga.png' %}">
<h3>Mind and Body Studio</h3>
<p>Yoga Classes are available with certified trainers</p>

29
</div>
<div class="about-col">
<img src="{% static 'images/group.png' %}">
<h3>Group Exercises</h3>
<p>Exercises are done in group to avoid intimidation</p>
</div>
</div>
</section>

<section class="VisitUs">
<h1>Let us help you with your Fitness Goals,Whether it is Fat Loss,Muscle Gain or
to Prepare for that Special event</h1>
<a href="{% url 'gym:plans' %}" class="hero-btn">Join Us</a>

</section>
<!--footer--->
<footer>
<div class="main-content">
<div class="left box">
<h2>About us</h2>
<div class="content">
<p>AM FITNESS is unisex fitness gym at coimbatore.We Provide World Class
training for your fitness needs.we will empower you to stick at it and make Health
and Fitness a major part of your life, (and the fun part!) rather than just a passing
fad</p>
<div class="social">
<a href="#"><span class="fab fa-facebook-f"></span></a>
<a href="#"><span class="fab fa-twitter"></span></a>
<a href="#"><span class="fab fa-instagram"></span></a>
<a href="#"><span class="fab fa-youtube"></span></a>
</div>
</div>
</div>

<div class="center box">


<h2>Address</h2>
<div class="content">
<div class="place">
<span class="fas fa-map-marker-alt"></span>
<span class="text">Peelamedu, Coimbatore</span>
</div>
<div class="phone">
<span class="fas fa-phone-alt"></span>
<span class="text">+919489443153</span>
</div>
<div class="email">
<span class="fas fa-envelope"></span>
<span class="text">axy@amfitness.ac.in</span>
30
</div>
</div>
</div>

<div class="right box">


<h2>Contact us</h2>
<div class="content">
<form method="POST" action="{% url 'gym:home' %}" >
{% csrf_token %}
<div class="email">
<div class="text">Email *</div>
<input type="email" name="enq_email" required>
</div>
<div class="msg">
<div class="text">Message *</div>
<textarea name="enquiry" rows="2" cols="25" required></textarea>
</div>
<div class="btn">
<button type="submit">Send</button>
</div>
</form>
</div>
</div>
</div>
<div class="bottom">
<center>
<span class="credit"><a href="#">AM FITNESS</a> | </span>
<span class="far fa-copyright"></span><span> 2020 All rights reserved.</span>
</center>
</div>
</footer>

</body>
</html>

31
views.py

from django.http.response import HttpResponse


from manage import models
from django.shortcuts import render,redirect
from django.contrib.auth.models import User , auth
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from gym.models import *
from manage.models import trainers
from datetime import date,timedelta
# Create your views here.

def login(request):

if request.method == 'POST':
username = request.POST.get('username')
password = request.POST.get('password')

user =
auth.authenticate(request,username=username,password=password)
if user is not None:
auth.login(request, user)
return redirect('adminpage')
else:
messages.error(request,'username or password not
correct')
return redirect('login')
else:
return render(request,'manage/login.html')
return render(request,'manage/login.html')

def enquiry(request):
enq = enquiries.objects.all()
d = {'enq':enq}
return render(request,'manage/ViewEnquiry.html',d)

def gymTrainers(request):
trainer = trainers.objects.all()
d = {'trainer':trainer}
return render(request,'manage/trainers.html',d)

def equipment(request):
eqp = equipments.objects.all()
d = {'eqp':eqp}
return render(request,'manage/equipments.html',d)

32
def addEquipment(request):
if request.method == "POST":
name = request.POST['name']
quantity = request.POST['quantity']
modelno = request.POST['model']
eqtype = request.POST['type']
price = request.POST['price']
warranty = request.POST['war_per']
warr = warranty + ' years'
dop = request.POST['dop']

equipments.objects.create(eq_name = name,units =
quantity,model_no = modelno,eq_type = eqtype,price = price,warranty
= warr,date_of_pur = dop)
return redirect('equipments')
return render(request,'manage/addEquipment.html')

def fees(request):
f = fee.objects.all()
d = {'f':f}
return render(request,'manage/fees.html',d)

def member(request):
members = gym.objects.all()
count = gym.objects.all().count()
d = {'members':members,'count':count}
return render(request,'manage/members.html',d)

def addMemmber(request):
if request.method == 'POST':
name = request.POST['name']
email = request.POST['email']
age = request.POST['age']
phone = request.POST['cell']
dob = request.POST['dob']
gender = request.POST['gender']
plan = request.POST['plan']

gym.objects.create(full_name=name,gender=gender,age=age,cell
_no=phone,born_date=dob,email=email,plan=plan)
f = gym.objects.get(full_name=name)
begindate = date.today()
if plan == 'Silver':
enddate = begindate + timedelta(days=30)
amount = 1000
elif plan == 'Gold':
enddate = begindate + timedelta(days=180)

33
amount = 8000
elif plan == 'Platinum':
enddate = begindate + timedelta(days=360)
amount = 25000
else:
return HttpResponse("Invalid Plan")
fee.objects.create(member=f,paid_status=True,pay_mode='Offli
ne',due_date=enddate,amt=amount)
return redirect('members')
return render(request,'manage/addMember.html')

def logout(request):
auth.logout(request)
return redirect('gym:home')

def updateFee(request,pid):
f = fee.objects.get(id=pid)

if f.paid_status == False:
f.paid_status = True
f.paid_date = date.today()
if f.amt == 1000:
due_date = f.paid_date + timedelta(days=30)
elif f.amt == 8000:
due_date = f.paid_date + timedelta(days=180)
elif f.amt == 25000:
due_date = f.paid_date + timedelta(days=360)
else:
print("Invalid Plan")
f.save()

return redirect('fee')

def deleteEnq(request,pid):
e = enquiries.objects.get(id=pid)
e.delete()
return redirect('enquiry')

def addTrainer(request):
if request.method == 'POST':
name = request.POST['name']
age = request.POST['age']
cell = request.POST['cell']
salary = request.POST['salary']
gender = request.POST['gender']
spl = request.POST['spl']

34
trainers.objects.create(trainer_name=name,trainer_age=age,tr
ainer_gender=gender,trainer_cell=cell,aos=spl,salary=salary)
return redirect('trainers')
return render(request,'manage/addTrainer.html')

@login_required
def adminPage(request):
total_members = gym.objects.all().count()
total_eq = equipments.objects.all().count()
total_enq = enquiries.objects.all().count()
total_fee = fee.objects.filter(paid_status = False).count()
mini_tab = gym.objects.filter().order_by('-date_joined')[:3]
context =
{'total_members':total_members,'total_eq':total_eq,'total_enq':total
_enq,'total_fee':total_fee,'mini_tab':mini_tab}
return render(request,'manage/dashboard.html',context)

35

You might also like