Create, Update, Delete, List todos. Each user could read/update/create/delete own todos.
Tech Stack:
- Django
- Django Rest Framework
- Jquery
- Bootstrap
Create environment
python3 -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
# Run tests
python manage.py test
# Run server
python manage.py runserver
Default username: admin, password: 12345678
Click to read!
curl --location --request POST 'localhost:8000/api/token-auth' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "admin",
"password": "12345678"
}'
{
"token": "18bea1824e361bb23a3be447fe97964c03cdd59d"
}
curl --location --request GET 'http://localhost:8000/api/todos/' \
--header 'Authorization: Token 18bea1824e361bb23a3be447fe97964c03cdd59d'
HTTP/1.1 200 OK
[
{
"id": 2,
"content": "Todo 2",
"done": true
},
{
"id": 1,
"content": "Todo 1",
"done": false
}
]
curl --location --request GET 'http://localhost:8000/api/todos/1/' \
--header 'Authorization: Token 18bea1824e361bb23a3be447fe97964c03cdd59d'
HTTP/1.1 200 OK
{
"id": 1,
"content": "Todo 1",
"done": false
}
curl --location --request POST 'http://localhost:8000/api/todos/' \
--header 'Authorization: Token 18bea1824e361bb23a3be447fe97964c03cdd59d' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": "Todo 3",
"done": false
}'
HTTP/1.1 201 CREATED
{
"content": "Todo 3",
"done": false
}
curl --location --request PUT 'http://localhost:8000/api/todos/3/' \
--header 'Authorization: Token 18bea1824e361bb23a3be447fe97964c03cdd59d' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": "Todo 3",
"done": true
}'
HTTP/1.1 200 OK
{
"id": 3,
"content": "Todo 3",
"done": true
}
curl --location --request DELETE 'http://localhost:8000/api/todos/3/' \
--header 'Authorization: Token 18bea1824e361bb23a3be447fe97964c03cdd59d'
HTTP/1.1 204 NO CONTENT
{
"id": null,
"content": "Todo 3",
"done": true
}
curl --location --request GET 'http://localhost:8000/api/todos/?search=todo' \
--header 'Authorization: Token 18bea1824e361bb23a3be447fe97964c03cdd59d'
[
{
"id": 3,
"content": "Todo 3",
"done": true
},
{
"id": 2,
"content": "Todo 2",
"done": false
}
]
curl --location --request GET 'http://localhost:8000/api/todos/?done=false' \
--header 'Authorization: Token 18bea1824e361bb23a3be447fe97964c03cdd59d'
[
{
"id": 2,
"content": "Todo 2",
"done": false
}
]
curl --location --request GET 'http://localhost:8000/api/todos/?seacrh=todo&done=true' \
--header 'Authorization: Token 18bea1824e361bb23a3be447fe97964c03cdd59d'
[
{
"id": 3,
"content": "Todo 3",
"done": true
}
]
Click to read!
Default username: admin, password: 12345678 Login via django admin login url than go to index page
Actions:
- Click
Add
to create todo item with statusNot Completed
- Click item detail to go item detail.
- Click
Update
to update existing todo content or status. - Click
Delete
to delete existing item. - Fill
Search
input, select todostatus
and clickSearch
to filter todo items on home page.