# Leave Management System
A Django-based Leave Management System to handle leave requests and approvals with role-based access.
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Setup](#setup)
- [Running the Application](#running-the-application)
- [API Endpoints](#api-endpoints)
- [Contributing](#contributing)
- [License](#license)
## Features
- User registration with role-based access.
- Leave request submission by employees.
- Leave approval by managers.
- View leave requests by HR and managers.
- JWT authentication for secure API access.
## Installation
1. **Clone the Repository**
```bash
git clone https://github.com/yourusername/Leave-Management-API.git
cd Leave-Management-API
-
Create a Virtual Environment
python -m venv env
-
Activate the Virtual Environment
On Windows:
.\env\Scripts\activate
On macOS/Linux:
source env/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Apply Migrations
python manage.py migrate
-
Run the Development Server
python manage.py runserver
The application will be available at
http://127.0.0.1:8000/
.
-
Start the Development Server
python manage.py runserver
-
Access the Application
Open your browser and navigate to
http://127.0.0.1:8000/
.
-
User Registration
- POST
/register/
- Request Body:
{ "first_name": "John", "last_name": "Doe", "username": "johndoe", "email": "john@example.com", "password": "yourpassword", "role": "EMPLOYEE" }
- POST
-
Submit Leave Request
- POST
/leave_request/
- Request Body:
{ "AssignedManager": 1, "reason": "Sick leave" }
- POST
-
List Managers
- GET
/managers_list/
- GET
-
View Leaves for HR
- GET
/hr_view_leaves/
- GET
-
View Leaves for Managers
- GET
/manager_view_leaves/
- GET
-
Approve Leave
- PATCH
/manager_approve_leave/<id>/
- Request Body:
{}
- PATCH
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature
). - Make your changes and commit (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Create a new Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
For further documentation and API details, refer to the Django REST framework documentation.
Feel free to modify it based on any additional features or specifics of your project!