Skip to content

Commit

Permalink
Merge pull request #14 from TheExecuter1/main
Browse files Browse the repository at this point in the history
Added Project
  • Loading branch information
Ruheej1 authored Oct 24, 2021
2 parents 1f0ff4c + 21a9cac commit ba87a29
Show file tree
Hide file tree
Showing 24 changed files with 596 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Backend/Invento_Manage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Backend-inventoManage
This is the Server of a Inventory Management App built whose client side is in React-Native and server side is in Django-RestFramework.
The database used here is sqlite


Empty file.
16 changes: 16 additions & 0 deletions Backend/Invento_Manage/backend/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for backend project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')

application = get_asgi_application()
143 changes: 143 additions & 0 deletions Backend/Invento_Manage/backend/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
"""
Django settings for backend project.
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'amexe&@hg!zn5qp$st5-25e=5lm-v=fen$@v9bb6n66eahm#&i'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True


ALLOWED_HOSTS = ['pal16sourav.pythonanywhere.com', '127.0.0.1']



# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'items',
'corsheaders',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'backend.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'backend.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
),
}



CORS_ORIGIN_ALLOW_ALL = False
CORS_ORIGIN_WHITELIST = (
'http://localhost:8000',
)
24 changes: 24 additions & 0 deletions Backend/Invento_Manage/backend/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""backend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from items import views

urlpatterns = [
path('admin/', admin.site.urls),
path('item/', include('items.urls')),
path('updates/', views.updates, name = 'updates')
]
16 changes: 16 additions & 0 deletions Backend/Invento_Manage/backend/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for backend project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')

application = get_wsgi_application()
33 changes: 33 additions & 0 deletions Backend/Invento_Manage/files/update.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
product_id,name,updated_at,qty_change,qty_available,old_price,new_price,updated_by




















4916,Mr.pal,12:57 12/18/20,0,10,200.0,200.0,will change to the user logged in










17009918,sinha,13:02 12/18/20,0,10,200.0,200.0,will change to the user logged in
Empty file.
6 changes: 6 additions & 0 deletions Backend/Invento_Manage/items/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin

from .models import Item , Inventory_User
# Register your models here.
admin.site.register(Item)
admin.site.register(Inventory_User)
5 changes: 5 additions & 0 deletions Backend/Invento_Manage/items/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ItemsConfig(AppConfig):
name = 'items'
38 changes: 38 additions & 0 deletions Backend/Invento_Manage/items/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 3.0.7 on 2020-12-02 05:18

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Item',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True)),
('price', models.FloatField()),
('description', models.CharField(max_length=255)),
('product_id', models.CharField(max_length=50)),
('quantity', models.IntegerField()),
('units', models.CharField(max_length=20)),
('category', models.CharField(max_length=20)),
],
),
migrations.CreateModel(
name='Inventory_User',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('phone_num', models.CharField(max_length=11, unique=True)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.0.7 on 2020-12-02 05:53

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('items', '0001_initial'),
]

operations = [
migrations.RemoveField(
model_name='item',
name='category',
),
]
22 changes: 22 additions & 0 deletions Backend/Invento_Manage/items/migrations/0003_auto_20201202_1715.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.1.4 on 2020-12-02 11:45

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('items', '0002_remove_item_category'),
]

operations = [
migrations.RemoveField(
model_name='item',
name='units',
),
migrations.AddField(
model_name='item',
name='category',
field=models.CharField(default='null', max_length=20),
),
]
23 changes: 23 additions & 0 deletions Backend/Invento_Manage/items/migrations/0004_auto_20201204_1714.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.1.3 on 2020-12-04 11:44

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('items', '0003_auto_20201202_1715'),
]

operations = [
migrations.AddField(
model_name='item',
name='created_at',
field=models.DateTimeField(auto_now=True),
),
migrations.AddField(
model_name='item',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.1.3 on 2020-12-04 11:50

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('items', '0004_auto_20201204_1714'),
]

operations = [
migrations.RemoveField(
model_name='item',
name='created_at',
),
]
19 changes: 19 additions & 0 deletions Backend/Invento_Manage/items/migrations/0006_auto_20201204_1723.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.1.3 on 2020-12-04 11:53

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('items', '0005_remove_item_created_at'),
]

operations = [
migrations.AlterField(
model_name='item',
name='updated_at',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]
Loading

0 comments on commit ba87a29

Please sign in to comment.