Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/admin #8

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
__pycache__
*.pyc
*.pyo
*.pyd
node_modules
staticfiles
.envs
theme/static_src/package-lock.json
migrations
30 changes: 30 additions & 0 deletions .github/workflows/django-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Django CI

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
python manage.py test
30 changes: 30 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Django CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
python manage.py test
18 changes: 18 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI

on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ dmypy.json
# pytype static type analyzer
.pytype/

*.csv

# Cython debug symbols
cython_debug/

Expand Down
49 changes: 49 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM python:3.9-slim

WORKDIR /app

RUN apt-get update && apt-get install -y \
build-essential \
libsqlite3-dev \
curl \
ca-certificates \
gnupg \
lsb-release \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs

RUN node -v && npm -v

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY scheema_retail_frontend/static_src/package.json ./scheema_retail_frontend/static_src/

WORKDIR /app/scheema_retail_frontend/static_src
RUN npm install -g yarn && yarn install


WORKDIR /app
COPY . .

RUN python manage.py makemigrations
RUN python manage.py makemigrations scheema_retail_store
RUN python manage.py migrate

RUN python manage.py seed_products


RUN python manage.py tailwind build

RUN python manage.py collectstatic


EXPOSE 8000

ENV DJANGO_SETTINGS_MODULE=e_commerce.settings
ENV PYTHONUNBUFFERED=1

CMD ["gunicorn", "--bind", "0.0.0.0:8000", "scheema_retail.wsgi:application"]
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# Scheema Retail
# Aliabba Retail
This project is a practical implementation focused on Ipswich Retail, aiming to transition from a monolithic system architecture to a more scalable and efficient Django MVT (Model-View-Template) framework. The goal is to address the limitations of the current system and enhance flexibility, maintainability, and performance by adopting a more modular approach.


## Views
### Overview
This is a Django views file for a retail store web application, handling various user interactions and e-commerce functionalities such as user authentication, product browsing, cart management, and order processing.

### Key Components
#### Authentication Views
- `CustomLoginView()`: Extends Django's default login view with cart migration for authenticated users
- `register()`: Handles user registration process
- `update_profile()`: Allows users to update their profile information
#### Product and Cart Management
- `home()`: Displays all available products
- `product_detail()`: Shows detailed information about a specific product
- `category_products()`: Lists products within a specific category
- `add_to_cart()`: Adds products to cart (supports both authenticated and guest users)
- `remove_from_cart()`: Reduces or removes cart items
- `view_cart()`: Displays current cart contents and calculates total cost
#### Order Processing
- `place_order()`: Creates an order from cart items
- `dashboard()`: Shows user's order history
#### Key Features
- Session-based cart for guest users
- Cart item migration during login
- Profile creation and management
- Product search functionality
- Dynamic cart total calculation
16 changes: 16 additions & 0 deletions configs/json_configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import json

def load_json_data(file_path):
"""
Loads the JSON data from the given file path.
"""
try:
with open(file_path, 'r', encoding='utf-8') as file:
data = json.load(file)
return data
except FileNotFoundError as e:
# sourcery skip: raise-specific-error
raise Exception(f"The file {file_path} was not found.") from e
except json.JSONDecodeError as e:
# sourcery skip: raise-specific-error
raise Exception(f"The file {file_path} is not a valid JSON file.") from e
Binary file added media/products/0071.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_c.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_d.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_e.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_f.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_g.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_h.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_i.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_j.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_l.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0071_m.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_c.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_d.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_e.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_f.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_g.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_h.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_i.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_j.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/products/0327_k.jpg
Binary file added media/products/0327_l.jpg
Binary file added media/products/0327_m.jpg
Binary file added media/products/0352.jpg
Binary file added media/products/0352_a.jpg
Binary file added media/products/0352_b.jpg
Binary file added media/products/0352_c.jpg
Binary file added media/products/0352_d.jpg
Binary file added media/products/0352_e.jpg
Binary file added media/products/0352_f.jpg
Binary file added media/products/0352_g.jpg
Binary file added media/products/0352_h.jpg
Binary file added media/products/0352_i.jpg
Binary file added media/products/0352_j.jpg
Binary file added media/products/0352_k.jpg
Binary file added media/products/0491.jpg
Binary file added media/products/0491_a.jpg
Binary file added media/products/0963.jpg
Binary file added media/products/0963_a.jpg
Binary file added media/products/0970.jpg
Binary file added media/products/0970_a.jpg
Binary file added media/products/1005.jpg
Binary file added media/products/1005_a.jpg
Binary file added media/products/1005_b.jpg
Binary file added media/products/1005_c.jpg
Binary file added media/products/1005_d.jpg
Binary file added media/products/1005_e.jpg
Binary file added media/products/1005_f.jpg
Binary file added media/products/1113.jpg
Binary file added media/products/1113_a.jpg
Binary file added media/products/1113_b.jpg
Binary file added media/products/1113_c.jpg
Binary file added media/products/1113_d.jpg
Binary file added media/products/1113_e.jpg
Binary file added media/products/1113_f.jpg
Binary file added media/products/1113_g.jpg
Binary file added media/products/1113_h.jpg
Binary file added media/products/1113_i.jpg
Binary file added media/products/1113_j.jpg
Binary file added media/products/1113_k.jpg
Binary file added media/products/1113_l.jpg
Binary file added media/products/1113_m.jpg
Binary file added media/products/1132.jpg
Binary file added media/products/1132_a.jpg
Binary file added media/products/1132_b.jpg
Binary file added media/products/1387.jpg
Binary file added media/products/1387_a.jpg
Binary file added media/products/1387_b.jpg
Binary file added media/products/1387_c.jpg
Binary file added media/products/1387_d.jpg
Binary file added media/products/1431.jpg
Binary file added media/products/1431_a.jpg
Binary file added media/products/1431_b.jpg
Binary file added media/products/1431_c.jpg
Binary file added media/products/1431_d.jpg
Binary file added media/products/1431_e.jpg
Binary file added media/products/1431_f.jpg
Binary file added media/products/1431_g.jpg
Binary file added media/products/1431_h.jpg
Binary file added media/products/1431_i.jpg
Binary file added media/products/1431_j.jpg
Binary file added media/products/1431_k.jpg
Binary file added media/products/1545.jpg
Binary file added media/products/1545_a.jpg
Binary file added media/products/1960.jpg
Binary file added media/products/1960_a.jpg
Binary file added media/products/1960_b.jpg
Binary file added media/products/1964.jpg
Binary file added media/products/1964_a.jpg
Binary file added media/products/1964_b.jpg
Binary file added media/products/1964_c.jpg
Binary file added media/products/2019.jpg
Binary file added media/products/2019_a.jpg
Binary file added media/products/2019_b.jpg
Binary file added media/products/2025.jpg
Binary file added media/products/2025_a.jpg
Binary file added media/products/2030.jpg
Binary file added media/products/2030_a.jpg
Binary file added media/products/2034.jpg
Binary file added media/products/2034_a.jpg
Binary file added media/products/2038.jpg
Binary file added media/products/2038_a.jpg
Binary file added media/products/2043.jpg
Binary file added media/products/2043_a.jpg
Binary file added media/products/2253.jpg
Binary file added media/products/2253_a.jpg
Binary file added media/products/2253_b.jpg
Binary file added media/products/2271.jpg
Binary file added media/products/2271_a.jpg
Binary file added media/products/2271_b.jpg
Binary file added media/products/2271_c.jpg
Binary file added media/products/2271_d.jpg
Binary file added media/products/2271_e.jpg
Binary file added media/products/2334.jpg
Binary file added media/products/2334_a.jpg
Binary file added media/products/2334_b.jpg
Binary file added media/products/2334_c.jpg
Binary file added media/products/2334_d.jpg
Binary file added media/products/2334_e.jpg
Binary file added media/products/2334_f.jpg
Binary file added media/products/2334_g.jpg
Binary file added media/products/2334_h.jpg
Binary file added media/products/2334_i.jpg
Binary file added media/products/2334_j.jpg
Binary file added media/products/2334_k.jpg
Binary file added media/products/2334_l.jpg
Binary file added media/products/2334_m.jpg
Binary file added media/products/2371.jpg
Binary file added media/products/2371_a.jpg
Binary file added media/products/2371_b.jpg
Binary file added media/products/2371_c.jpg
Binary file added media/products/2371_d.jpg
Binary file added media/products/2371_e.jpg
Binary file added media/products/2592.jpg
Binary file added media/products/2592_a.jpg
Binary file added media/products/2592_b.jpg
Binary file added media/products/2646.jpg
Binary file added media/products/2646_a.jpg
Binary file added media/products/2646_b.jpg
Binary file added media/products/2646_c.jpg
Binary file added media/products/2646_d.jpg
Binary file added media/products/2646_e.jpg
Binary file added media/products/2646_f.jpg
Binary file added media/products/2646_g.jpg
Binary file added media/products/2658.jpg
Binary file added media/products/2658_a.jpg
Binary file added media/products/2658_b.jpg
Binary file added media/products/2658_c.jpg
Binary file added media/products/2658_d.jpg
Binary file added media/products/2724.jpg
Binary file added media/products/2724_a.jpg
Binary file added media/products/2724_b.jpg
Binary file added media/products/2724_c.jpg
Binary file added media/products/2981.jpg
Binary file added media/products/2981_a.jpg
Binary file added media/products/2981_b.jpg
Binary file added media/products/3014.jpg
Binary file added media/products/3014_a.jpg
Binary file added media/products/3014_b.jpg
Binary file added media/products/3014_c.jpg
Binary file added media/products/3014_d.jpg
Binary file added media/products/3405.jpg
Binary file added media/products/3405_a.jpg
Binary file added media/products/3405_b.jpg
Binary file added media/products/3406.jpg
Binary file added media/products/3406_a.jpg
Binary file added media/products/3407.jpg
Binary file added media/products/3407_a.jpg
Binary file added media/products/3408.jpg
Binary file added media/products/3408_a.jpg
Binary file added media/products/3409.jpg
Binary file added media/products/3409_a.jpg
Binary file added media/products/3410.jpg
Binary file added media/products/3410_a.jpg
Binary file added media/products/3411.jpg
Binary file added media/products/3411_a.jpg
Binary file added media/products/3412.jpg
Binary file added media/products/3412_a.jpg
Binary file added media/products/3437.jpg
Binary file added media/products/3437_a.jpg
Binary file added media/products/3437_b.jpg
Binary file added media/products/3438.jpg
Binary file added media/products/3438_a.jpg
Binary file added media/products/3439.jpg
Binary file added media/products/3439_a.jpg
Binary file added media/products/3440.jpg
Binary file added media/products/3440_a.jpg
Binary file added media/products/3441.jpg
Binary file added media/products/3441_a.jpg
Binary file added media/products/3442.jpg
Binary file added media/products/3442_a.jpg
Binary file added media/products/3443.jpg
Binary file added media/products/3443_a.jpg
Binary file added media/products/3474.jpg
Binary file added media/products/3474_a.jpg
Binary file added media/products/3474_b.jpg
Binary file added media/products/3475.jpg
Binary file added media/products/3475_a.jpg
Binary file added media/products/3476.jpg
Binary file added media/products/3476_a.jpg
Binary file added media/products/3477.jpg
Binary file added media/products/3477_a.jpg
Binary file added media/products/3478.jpg
Binary file added media/products/3478_a.jpg
Binary file added media/products/3479.jpg
Binary file added media/products/3479_a.jpg
Binary file added media/products/3481.jpg
Binary file added media/products/3481_a.jpg
Binary file added media/products/3482.jpg
Binary file added media/products/3482_a.jpg
Binary file added media/products/3966.jpg
Binary file added media/products/3966_a.jpg
Binary file added media/products/3966_b.jpg
Binary file added media/products/4401.jpg
Binary file added media/products/4401_a.jpg
Binary file added media/products/4401_b.jpg
Binary file added media/products/4401_c.jpg
Binary file added media/products/4401_d.jpg
Binary file added media/products/4401_e.jpg
Binary file added media/products/4401_f.jpg
Binary file added media/products/4401_g.jpg
Binary file added media/products/4415.jpg
Binary file added media/products/4415_a.jpg
Binary file added media/products/4415_b.jpg
Binary file added media/products/4415_c.jpg
Binary file added media/products/4415_d.jpg
Binary file added media/products/4730.jpg
Binary file added media/products/4730_a.jpg
Binary file added media/products/4730_b.jpg
Binary file added media/products/4730_c.jpg
Binary file added media/products/4730_d.jpg
Binary file added media/products/4730_e.jpg
Binary file added media/products/4730_f.jpg
Binary file added media/products/4730_g.jpg
Binary file added media/products/4730_h.jpg
Binary file added media/products/4730_i.jpg
Binary file added media/products/4730_j.jpg
Binary file added media/products/4730_k.jpg
Binary file added media/products/4730_l.jpg
Binary file added media/products/4730_m.jpg
Binary file added media/products/4730_n.jpg
Binary file added media/products/4796.jpg
Binary file added media/products/4796_a.jpg
Binary file added media/products/4796_b.jpg
Binary file added media/products/4797.jpg
Binary file added media/products/4797_a.jpg
Binary file added media/products/4851.jpg
Binary file added media/products/4851_a.jpg
Binary file added media/products/4907.jpg
Binary file added media/products/4907_a.jpg
Binary file added media/products/4907_b.jpg
Binary file added media/products/4907_c.jpg
Binary file added media/products/4907_d.jpg
Binary file added media/products/4907_e.jpg
Binary file added media/products/4907_f.jpg
Binary file added media/products/4907_g.jpg
Binary file added media/products/4907_h.jpg
Binary file added media/products/4907_i.jpg
Binary file added media/products/5285.jpg
Binary file added media/products/5285_a.jpg
Binary file added media/products/5285_b.jpg
Binary file added media/products/5285_c.jpg
Binary file added media/products/5285_d.jpg
Binary file added media/products/5285_e.jpg
Binary file added media/products/5285_f.jpg
Binary file added media/products/5285_g.jpg
Binary file added media/products/5285_h.jpg
Binary file added media/products/5285_i.jpg
Binary file added media/products/5285_j.jpg
Binary file added media/products/5285_k.jpg
Binary file added media/products/5372.jpg
Binary file added media/products/5372_a.jpg
Binary file added media/products/5372_b.jpg
Binary file added media/products/5488.jpg
Binary file added media/products/5488_a.jpg
Binary file added media/products/5488_b.jpg
Binary file added media/products/5488_c.jpg
Binary file added media/products/5488_d.jpg
Binary file added media/products/5488_e.jpg
Binary file added media/products/5488_f.jpg
Binary file added media/products/5488_g.jpg
Binary file added media/products/5488_h.jpg
Binary file added media/products/5488_i.jpg
Binary file added media/products/5488_j.jpg
Binary file added media/products/5488_k.jpg
Binary file added media/products/5488_l.jpg
Binary file added media/products/5488_m.jpg
Loading
Loading