2021-07-13 19:44:12 +02:00
|
|
|
# Example of CRUD in Django with REST FRAMEWORK
|
|
|
|
|
|
|
|
All endpoints contain your test.
|
|
|
|
|
2021-07-14 16:58:09 +02:00
|
|
|
## Live Demo
|
2021-07-13 19:44:12 +02:00
|
|
|
|
2021-07-14 16:58:09 +02:00
|
|
|
### Get list
|
|
|
|
|
|
|
|
### Get Detail
|
|
|
|
|
|
|
|
### Create
|
|
|
|
|
|
|
|
### Update
|
|
|
|
|
|
|
|
### Delete
|
2021-07-13 19:44:12 +02:00
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
``` bash
|
|
|
|
python3 -m venv venv
|
|
|
|
source venv/bin/activate
|
|
|
|
pip3 install -r requirements.txt
|
|
|
|
python3 manage.py migrate
|
|
|
|
```
|
|
|
|
|
|
|
|
## Run
|
|
|
|
|
|
|
|
``` bash
|
|
|
|
python3 manage.py runserver
|
|
|
|
```
|
2021-07-13 19:45:27 +02:00
|
|
|
|
2021-07-14 16:46:34 +02:00
|
|
|
## Fake data
|
|
|
|
|
|
|
|
``` bash
|
|
|
|
python3 manage.py runscript create_books
|
|
|
|
```
|
|
|
|
|
2021-07-13 19:45:27 +02:00
|
|
|
## Test
|
|
|
|
|
|
|
|
``` bash
|
|
|
|
pytest
|
|
|
|
```
|