Git Product home page Git Product logo

exploring-drf's Introduction

exploring-drf

This is a project exploring the Django-Rest-Framework with Djoser.

Through the project, I created Function-based views, Class-based views, Class-based views for Serialized Models, Generic views for Serialized Models and Viewsets. In the final code, everything except the Viewsets is commented out. Relevant URLs and code can be uncommented to explore different functionality as well.

Installation

First, clone the repository and create a virtual environment. Install all dependencies and start the server.

git clone https://github.com/chouhanaryan/exploring-drf.git
cd .\exploring-drf\
pipenv shell
pipenv install
cd .\drf\
python manage.py runserver

ER Diagram

ERD

(generated using Pygraphviz)

Usage

  • Root

GET /

Response - URLs of main API structure

  • Login

POST /auth/token/login/

Response - Returns authorization token

Body - Password, Email

  • Logout (Authentication Required)

POST /auth/token/logout/

Response - None

  • Users (Authentication Required)

GET /auth/users/

Response - Detailed list of all users

  • Users (Authentication Required)

POST /auth/users/

Response - Register a new user

Body - Username, First name, Last name, Email, Password, Re password

  • Person (Authentication Required)

GET | POST | PUT | DELETE /person/

Response - Detailed list of all people registered

Body - Name, Email, DOB, Age, ID (as and when required)

  • Person (ID) (Authentication Required)

GET /person/<id>/

Response - Details of specific person by ID

  • House (Authentication Required)

GET | POST | PUT | DELETE /house/

Response - Detailed list of all houses registered

Body - Loc, Owner (URL), pin (unique), ID (as and when required)

  • House (ID) (Authentication Required)

GET /house/<id>/

Response - Details of specific house by ID

Notes

To explore the API, use Postman or any other API development platforms.

Administrator login credentials:

email: [email protected]

password: admin

User login credentials:

email: [email protected] / [email protected]

password: Aryan123

Login using any of these by sending the appropriate request to the API, and you shall receive an authorization token. Now, include this token as a header (format: Authorization: Token <token>) to send requests that require authorization.

The administrator credentials can also be used to manually add people, houses, users and generate tokens via the Django admin panel.

Documentation for additional functionality can be accessed at the Djoser docs.

exploring-drf's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.