Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/freddyb19/todo-app
An application to create, list, update, and delete tasks
https://github.com/freddyb19/todo-app
bootstrap5 django django-rest-framework todo-app
Last synced: about 2 months ago
JSON representation
An application to create, list, update, and delete tasks
- Host: GitHub
- URL: https://github.com/freddyb19/todo-app
- Owner: freddyB19
- Created: 2024-03-30T16:32:36.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-03-30T21:51:23.000Z (10 months ago)
- Last Synced: 2024-03-30T22:25:08.459Z (10 months ago)
- Topics: bootstrap5, django, django-rest-framework, todo-app
- Language: JavaScript
- Homepage:
- Size: 1.04 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ToDo App
An application to create, list, update, and delete tasks
## Installation
Install and update using pip:
```
1. Clone the repository::git clone https://github.com/freddyB19/todo-app.git
cd todo-app2. Create and activate a virtual environment::
python3 -m venv env
source env/bin/activate3. Install requirements::
pip install -r requirements.txt
4. Run the application::
python3 manage.py migrate
python3 manage.py runserver
```
## Views### Root URL
```http
/todo/
```
### CreateTaskFormView()
- _URL_: **/task/create/**View to create tasks
### TasksListView()
- _URL_: **/task/list/**
- Pagination:
- param: ( page )
- paginate_by: 3View to see all tasks. With this you can perform filtered searches for tasks _(completed, uncompleted and all tasks)_
### DetailTaskDetailView()
- _URL_: **/task/{pk}/detail/**
- pk = task idView to see the details of a task
### UpdateInfoTaskView()
- _URL_: **/task/{pk}/info/update/**
- pk = task idView to see updating a task, when the operation is successful it redirects you to the task list view
### CompleteTaskView()
- _URL_: **/task/{pk}/status/update/**
- pk = task idView to partially update a task. With this view you can mark a task as completed, when the operation is successful it redirects you to the task list view
### DeleteTaskView()
- _URL_: **/task/{pk}/delete/**
- pk = task idView to delete a task, when the operation is successful it redirects you to the task list view
## API Reference
For API configurations, the following was done:
- There is a limit of 2000 requests to create a task per day
- There is a limit of 5000 requests to list all tasks per day
- CORS ALLOWED ORIGINS (localhost:8000)
- CSRF TRUSTED ORIGINS (localhost:8000)
- CORS DEFAULT METHODS = **ACTIVATED**
- CORS DEFAULT HEADERS = **ACTIVATED**### Root URL
```http
/todo/api/v1/
```#### POST create task
```http
GET /task/create/
```
**Response::**
1. Valid:
- HTTP 201 Created
- Return the created task
- Pagination:
- params: (limit, offset)
- default_limit: 5
- max_limit: 10#### Get all tasks
```http
GET /tasks/
```| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| `?is_complete=` | `bool` | **Optional**. To do filtered searches |**Response::**
1. Valid:
- HTTP 200 OK
- Return a list of tasks
- Pagination:
- params: (limit, offset)
- default_limit: 5
- max_limit: 10#### Get task
```http
GET /task/${pk}/
```| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `pk` | `int` | **Required**. Id of item to fetch |**Response::**
1. Valid:
- HTTP 200 OK
- Return the detail of a task
2. Invalid
- HTTP 404 Not Found
```json
"error": {
"message": "There is no task with this id"
}
```#### Update task
```http
PUT /task/${pk}/
```| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `pk` | `int` | **Required**. Id of item to fetch |**Response::**
1. Valid:
- HTTP 200 OK
- Return the updated task
2. Invalid
- HTTP 404 Not Found
```json
"error": {
"message": "There is no task with this id"
}
```#### Update Partial task
```http
PATCH /task/${pk}/
```| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `pk` | `int` | **Required**. Id of item to fetch |**Response::**
1. Valid:
- HTTP 200 OK
- Return the updated task
2. Invalid
- HTTP 404 Not Found
```json
"error": {
"message": "There is no task with this id"
}
```#### Delete task
```http
DELETE /task/${pk}/
```| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `pk` | `int` | **Required**. Id of item to fetch |**Response::**
1. Valid:
- HTTP 204 No Content
2. Invalid
- HTTP 404 Not Found
```json
"error": {
"message": "There is no task with this id"
}
```## Running Tests
The tests for the project are located in the ***tests folder***.
In it you can find the tests for:
- Models
- Views
- FormsTo run tests, run the following command:
### Test Models
```bash
python3 manage.py test apps.task.tests.tests_models
```
### Test Forms
```bash
python3 manage.py test apps.task.tests.tests_models
```
### Test Views
```bash
python3 manage.py test apps.task.tests.tests_models
```
### API TestsThe API tests are located in the ***apiv1 folder***
Command:
```bash
python3 manage.py test apps.task.apiv1
```## Deployment
> [!IMPORTANT]
> It is recommended to make some configurations to run in production. Since this project does not meet all the requirementsFor more information read the following documentations:
[Django](https://docs.djangoproject.com/en/5.0/)
[Django REST framework](https://www.django-rest-framework.org/).
[django-cors-headers](https://github.com/adamchainz/django-cors-headers).