This project is a Task Management System built using Django and Django REST Framework. It allows users to manage tasks, including creating, updating, listing, and deleting tasks. The system also includes user authentication using JWT (JSON Web Tokens).
Before you begin, ensure you have met the following requirements:
- Python 3.8 or higher
- Django 5.1.3 or higher
- MySQL or any other supported database
pip
for installing Python packages
-
Clone the repository:
git clone https://github.com/yourusername/task-management.git cd task-management
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up your database configuration in
task_management/settings.py
:DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'task_management_db', 'USER': 'root', 'PASSWORD': 'admin', 'HOST': 'localhost', 'PORT': '3306', } }
-
Apply migrations to create the database schema:
python manage.py migrate
-
Start the Django development server:
python manage.py runserver
-
The application should now be running at
http://127.0.0.1:8000/
.
- URL:
/api/register/
- Method:
POST
- Request Body:
{ "username": "your_username", "password": "your_password", "email": "your_email@example.com" }
- Response:
{ "username": "your_username", "email": "your_email@example.com" }
- URL:
/api/login/
- Method:
POST
- Request Body:
{ "username": "your_username", "password": "your_password" }
- Response:
{ "refresh": "your_refresh_token", "access": "your_access_token" }
- URL:
/api/logout/
- Method:
POST
- Request Body:
{}
- Response:
{ "message": "Logged out successfully!" }
- URL:
/api/tasks/
- Method:
POST
- Headers:
{ "Authorization": "Bearer your_access_token" }
- Request Body:
{ "title": "Task Title", "description": "Task Description", "priority": "medium", "status": "in-progress", "deadline": "2024-12-31" }
- Response:
{ "id": 1, "title": "Task Title", "description": "Task Description", "priority": "medium", "status": "in-progress", "deadline": "2024-12-31", "created_at": "2024-11-22T12:34:56Z", "updated_at": "2024-11-22T12:34:56Z" }
- URL:
/api/tasks/list/
- Method:
GET
- Headers:
{ "Authorization": "Bearer your_access_token" }
- Query Parameters:
status
: Filter by task status (e.g.,yet-to-start
,in-progress
,completed
,hold
)priority
: Filter by task priority (e.g.,low
,medium
,high
)description
: Filter by task description (partial match)title
: Filter by task title (partial match)start_date
: Filter tasks with deadlines greater than or equal to this dateend_date
: Filter tasks with deadlines less than or equal to this date
- Response:
[ { "id": 1, "title": "Task Title", "description": "Task Description", "priority": "medium", "status": "in-progress", "deadline": "2024-12-31", "created_at": "2024-11-22T12:34:56Z", "updated_at": "2024-11-22T12:34:56Z" }, ... ]
- URL:
/api/tasks/{task_id}/
- Method:
PUT
- Headers:
{ "Authorization": "Bearer your_access_token" }
- Request Body:
{ "title": "Updated Task Title", "description": "Updated Task Description", "priority": "high", "status": "completed", "deadline": "2024-12-31" }
- Response:
{ "id": 1, "title": "Updated Task Title", "description": "Updated Task Description", "priority": "high", "status": "completed", "deadline": "2024-12-31", "created_at": "2024-11-22T12:34:56Z", "updated_at": "2024-11-22T12:34:56Z" }
- URL:
/api/tasks/delete/{task_id}/
- Method:
DELETE
- Headers:
{ "Authorization": "Bearer your_access_token" }
- Response:
{}
Request:
curl -X POST http://127.0.0.1:8000/api/register/ -H "Content-Type: application/json" -d '{"username": "testuser", "password": "testpassword", "email": "test@example.com"}'
Response:
{
"username": "testuser",
"email": "test@example.com"
}
Request:
curl -X POST http://127.0.0.1:8000/api/login/ -H "Content-Type: application/json" -d '{"username": "testuser", "password": "testpassword"}'
Response:
{
"refresh": "your_refresh_token",
"access": "your_access_token"
}
Request:
curl -X POST http://127.0.0.1:8000/api/tasks/ -H "Authorization: Bearer your_access_token" -H "Content-Type: application/json" -d '{"title": "New Task", "description": "Task Description", "priority": "medium", "status": "in-progress", "deadline": "2024-12-31"}'
Response:
{
"id": 1,
"title": "New Task",
"description": "Task Description",
"priority": "medium",
"status": "in-progress",
"deadline": "2024-12-31",
"created_at": "2024-11-22T12:34:56Z",
"updated_at": "2024-11-22T12:34:56Z"
}
Request:
curl -X GET http://127.0.0.1:8000/api/tasks/list/ -H "Authorization: Bearer your_access_token"
Response:
[
{
"id": 1,
"title": "New Task",
"description": "Task Description",
"priority": "medium",
"status": "in-progress",
"deadline": "2024-12-31",
"created_at": "2024-11-22T12:34:56Z",
"updated_at": "2024-11-22T12:34:56Z"
},
...
]
Request:
curl -X PUT http://127.0.0.1:8000/api/tasks/1/ -H "Authorization: Bearer your_access_token" -H "Content-Type: application/json" -d '{"title": "Updated Task", "description": "Updated Description", "priority": "high", "status": "completed", "deadline": "2024-12-31"}'
Response:
{
"id": 1,
"title": "Updated Task",
"description": "Updated Description",
"priority": "high",
"status": "completed",
"deadline": "2024-12-31",
"created_at": "2024-11-22T12:34:56Z",
"updated_at": "2024-11-22T12:34:56Z"
}
Request:
curl -X DELETE http://127.0.0.1:8000/api/tasks/delete/1/ -H "Authorization: Bearer your_access_token"
Response:
{}
This README provides a comprehensive guide to setting up, configuring, and using the Task Management System. Follow the instructions to get the project up and running, and use the API endpoints to manage tasks and user authentication.