Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ozansz/drivebuddy-task
Driver model implementation using Django REST Framework
https://github.com/ozansz/drivebuddy-task
django django-rest-framework python rest-api
Last synced: 28 days ago
JSON representation
Driver model implementation using Django REST Framework
- Host: GitHub
- URL: https://github.com/ozansz/drivebuddy-task
- Owner: ozansz
- License: mit
- Created: 2018-03-13T17:41:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-03-13T20:42:31.000Z (over 6 years ago)
- Last Synced: 2024-10-05T07:03:27.930Z (about 1 month ago)
- Topics: django, django-rest-framework, python, rest-api
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# drivebuddy-task
Driver model implementation using Django REST Framework
## Installation
Before cloning the repository, you need `django` and `djangorestframework` packages installed.
To install them, run the command below:
```bash
pip install django djangorestframework
```Then, you can clone the repo:
```bash
git clone https://github.com/ozansz/drivebuddy-task
cd ./drivebuddy-task
```And to run the server, run the command below:
```bash
python manage.py makemigrations drivers
python manage.py migrate
python manage.py runserver
```## API
The RESTful API implements CRUD functionality for the `Driver` model.
### The Driver Model
The `Driver` model has three fields:
-
name - Name of the driver -
email - Unique email of the driver -
score - Score of the driver
### API Endpoints
The API endpoints for the `Driver` model are under the `/drivers` path.
#### Create driver
Request: `POST`
Path: `/drivers/`
Request body:
`name`:
`email`:
`score`:
Response: `201 - Created`
#### Read driver
Request: `GET`
Path: `/drivers/`
Response: `200 - OK`
Response body:
`url`:
`name`:
`email`:
`score`:
#### Update driver
Request: `PUT`
Path: `/drivers/`
Request body:
`name`:
`email`:
`score`:
Response: `200 - OK`
Response body:
`url`:
`name`:
`email`:
`score`:
#### Delete driver
Request: `DELETE`
Path: `/drivers/`
Response: `204 - No Content`
## Tests
There are 6 tests implemented to test the CRUD functionality of the API.
You can run the tests running the command below:
```bash
python manage.py test
```