- Overview
- Project Info
- Entity Relationship Diagram
- Preview
- Built With
- Project Structure
- How to use
- Contact
- I created a Stock Manegement API with Django Rest Framework that allows users to
- register/login/logout
- CRUD operations for Product,Transaction,Firm, Brand, and Category acoording to user's role
- Manager:
- Authorized all CRUD operations in Stock App
- Product_Manager:
- Authorized all CRUD operations in Category, Brand, Firm, Product tables
- Finance:
- Authorized all CRUD operations in Transaction table and read only other tables
- Read_Only:
- Authorized only read operations in all tables
- Transaction field, which in Transaction table, determines the type of stock object.
- If the transaction is 'IN' stock of product object is recalculating.
- If the transaction is 'OUT' we are checking stock of product in Product table if there is enough stock. In the case of does not enough stock in product we are raising ValidationError otherwise we are recalculating the stock of product object.
- Price_total field, which in Stock table, is read_only field and we are calculating this value with quantity and price fields.
- All views have filter and search features.
- In addition to the filters in category views we have also nested serializer which shows us products belonging to categories.
- Django
- Django Rest Framework
- Django Rest Auth
- Django Nested Admin
- Django Debug Toolbar
- Django Filter
- PosrtgreSQL
- Swagger
.──── django-stock-app (repo)
│
├── main
│ ├── __pycache__
│ ├── __init__.py
│ ├── asgi.py
│ ├── urls.py
│ ├── wsgi.py
│ └── settings
│ ├── __pycache__
│ ├── db.sqlite3
│ ├── __init__.py
│ ├── base.py
│ ├── dev.py
│ └── prod.py
│─── stock
│ ├── __pycache__
│ │── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── signals.py
│ ├── permissions.py
│ ├── serializers.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├──── users
│ ├── __pycache__
│ ├── migrations
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── serializers.py
│ ├── signals.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── manage.py
├── db.sqlite3
├── debug.log
├── requirements.txt
└── .env
To clone and run this application, you'll need Git
# Clone this repository
$ git clone https://github.com/esadakman/django-stock-app
# Install dependencies
$ python -m venv env
> env/Scripts/activate (for win OS)
$ source env/bin/activate (for macOs/linux OS)
$ pip install -r requirements.txt
# Add .env file for secret key, ENV_NAME and SQL informations
- Create a .env file for =>
-- SECRET_KEY,
-- ENV_NAME=dev # switch to prod when in production
-- DEBUG=True, # switch to False when in production
-- SQL_DATABASE='dbName',
-- SQL_USER='dbUserName',
-- SQL_PASSWORD='dbPassword',
-- SQL_HOST=localhost and
-- SQL_PORT=5432
- After these you can run the project as usual =>
# Run the app
$ python manage.py runserver
- Website @esadakman
- GitHub @esadakman
- Linkedin @esadakman