diff --git a/README.md b/README.md deleted file mode 100644 index 51fc1f691..000000000 --- a/README.md +++ /dev/null @@ -1,228 +0,0 @@ -# Complete Git and Pull Request Tutorial (Git Together) - -Welcome to the comprehensive Git and Pull Request tutorial for the Xplore project! This guide will walk you through the entire process of contributing to the project, from forking the repository to creating a pull request. We'll cover basic and advanced Git commands, error handling, and best practices. - -## Table of Contents - -1. [Getting Started](#getting-started) -2. [Basic Git Commands](#basic-git-commands) -3. [Making Changes](#making-changes) -4. [Advanced Git Commands](#advanced-git-commands) -5. [Creating a Pull Request](#creating-a-pull-request) -6. [Troubleshooting](#troubleshooting) -7. [Best Practices](#best-practices) -8. [Interactive Practice](#interactive-practice) - -## Getting Started - -### 1. Fork the Repository - -1. Visit the [Xplore repository](https://github.com/SharanRP/Xplore) on GitHub. -2. Click the "Fork" button in the top-right corner to create a copy in your account. - - - -### 2. Clone Your Fork - -Clone your forked repository to your local machine: - -```bash -git clone https://github.com/YOUR_USERNAME/Xplore.git -``` - -Replace `YOUR_USERNAME` with your GitHub username. - -### 3. Navigate to the Project Directory - -```bash -cd Xplore -``` - -### 4. Set Up Remote - -Add the original repository as a remote to keep your fork updated: - -```bash -git remote add upstream https://github.com/SharanRP/Xplore.git -``` - -## Basic Git Commands - -### Checking Status - -View the status of your working directory: - -```bash -git status -``` - -### Creating a New Branch - -Create and switch to a new branch: - -```bash -git checkout -b feature/your-feature-name -``` - -### Viewing Branches - -List all branches: - -```bash -git branch -``` - -### Switching Branches - -Switch to an existing branch: - -```bash -git checkout branch-name -``` - -## Making Changes - -1. Make your desired changes to the codebase. -2. Stage your changes: - ```bash - git add . - ``` -3. Commit your changes: - ```bash - git commit -m "Add feature xyz" - ``` -4. Push your changes to your fork: - ```bash - git push origin feature/your-feature-name - ``` - -## Advanced Git Commands - -### Stashing Changes - -Temporarily store changes: - -```bash -git stash -``` - -Apply stashed changes: - -```bash -git stash pop -``` - -### Fetching Updates - -Fetch updates from the original repository: - -```bash -git fetch upstream -``` - -### Merging Changes - -Merge updates from the original repository: - -```bash -git checkout main -git merge upstream/main -``` - -### Rebasing - -Rebase your feature branch: - -```bash -git checkout feature/your-feature-name -git rebase main -``` - -### Using git reset - -`git reset` is a powerful command for undoing changes and managing your commit history. Use it carefully to avoid losing work. - -#### Types of reset: - -1. **Soft reset** (`--soft`): Moves HEAD but doesn't change staging area or working directory. -2. **Mixed reset** (`--mixed` or default): Moves HEAD and updates staging area. -3. **Hard reset** (`--hard`): Moves HEAD, updates staging area and working directory. - -#### Common use cases: - -- Undo last commit (keep changes): `git reset HEAD~1` -- Undo multiple commits: `git reset HEAD~n` (replace `n` with number of commits) -- Reset to specific commit: `git reset commit-hash` -- Unstage changes: `git reset HEAD file-name` -- Discard all local changes (use cautiously): `git reset --hard HEAD` - -## Creating a Pull Request - -1. Go to your forked repository on GitHub. -2. Switch to your new branch. -3. Click "New Pull Request". -4. Select the base repository and branch you want to merge into. -5. Provide a title and description for your changes. -6. Click "Create Pull Request". - - - -## Troubleshooting - -### Common Errors and Solutions - -1. **"fatal: not a git repository"** - - Solution: Ensure you're in the correct directory or initialize with `git init`. - -2. **"fatal: remote origin already exists"** - - Solution: Update the remote URL: - ```bash - git remote set-url origin https://github.com/YOUR_USERNAME/Xplore.git - ``` - -3. **"error: failed to push some refs"** - - Solution: Pull the latest changes before pushing: - ```bash - git pull origin main - ``` - -4. **"You are in 'detached HEAD' state"** - - Solution: Return to the original branch: - ```bash - git checkout branch-name - ``` - -## Best Practices - -1. Keep commits small and focused on a single change. -2. Write clear, concise commit messages. -3. Pull the latest changes from upstream before starting new work. -4. Use branches for new features or bug fixes. -5. Review your changes before committing. -6. Test your changes thoroughly before creating a pull request. - -## Interactive Practice - -Try this exercise to practice the Git workflow: - -1. Create a new branch called `practice/your-name`. -2. Create a new file called `your-name.md` with some content about yourself. -3. Stage and commit this file. -4. Push the branch to your fork. -5. Create a pull request for this branch. -6. Make a change to your file, commit, and push again. -7. Use `git reset` to undo the last commit while keeping the changes. -8. Recommit the changes with a different commit message. -9. Force push the branch to update your pull request. - -## Adding Your Information - -Please add your name and registration number below: - -- Name: [Your Name] -- Registration Number: [Your Registration Number] - -Congratulations on completing this comprehensive Git and Pull Request tutorial! Remember, practice is key to mastering Git. Don't hesitate to experiment in a test repository to gain more confidence with these commands. - -If you have any questions or encounter any issues, please don't hesitate to ask for help. Happy coding! -"# INH-git" diff --git a/ecom/db.sqlite3 b/ecom/db.sqlite3 new file mode 100644 index 000000000..e69de29bb diff --git a/ecom/ecom/__init__.py b/ecom/ecom/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ecom/ecom/__pycache__/__init__.cpython-313.pyc b/ecom/ecom/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 000000000..e33a449d7 Binary files /dev/null and b/ecom/ecom/__pycache__/__init__.cpython-313.pyc differ diff --git a/ecom/ecom/__pycache__/settings.cpython-313.pyc b/ecom/ecom/__pycache__/settings.cpython-313.pyc new file mode 100644 index 000000000..e15ef5e83 Binary files /dev/null and b/ecom/ecom/__pycache__/settings.cpython-313.pyc differ diff --git a/ecom/ecom/__pycache__/urls.cpython-313.pyc b/ecom/ecom/__pycache__/urls.cpython-313.pyc new file mode 100644 index 000000000..d01dab664 Binary files /dev/null and b/ecom/ecom/__pycache__/urls.cpython-313.pyc differ diff --git a/ecom/ecom/__pycache__/wsgi.cpython-313.pyc b/ecom/ecom/__pycache__/wsgi.cpython-313.pyc new file mode 100644 index 000000000..1f688a8f1 Binary files /dev/null and b/ecom/ecom/__pycache__/wsgi.cpython-313.pyc differ diff --git a/ecom/ecom/asgi.py b/ecom/ecom/asgi.py new file mode 100644 index 000000000..fa0fc6438 --- /dev/null +++ b/ecom/ecom/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for ecom 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/5.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ecom.settings') + +application = get_asgi_application() diff --git a/ecom/ecom/settings.py b/ecom/ecom/settings.py new file mode 100644 index 000000000..d9b15d4fa --- /dev/null +++ b/ecom/ecom/settings.py @@ -0,0 +1,129 @@ +""" +Django settings for ecom project. + +Generated by 'django-admin startproject' using Django 5.1.4. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.1/ref/settings/ +""" + +from pathlib import Path +import os + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-6pk-q@^*h3^(9w$@+#tl7_-%*(#6!ayywls!$%(r41e@2^c6$b' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'store.apps.StoreConfig', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'ecom.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 = 'ecom.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.1/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/5.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.1/howto/static-files/ + +STATIC_URL = 'static/' + +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'static') +] + +# Default primary key field type +# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/ecom/ecom/urls.py b/ecom/ecom/urls.py new file mode 100644 index 000000000..0309f4f39 --- /dev/null +++ b/ecom/ecom/urls.py @@ -0,0 +1,23 @@ +""" +URL configuration for ecom project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/5.1/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 + +urlpatterns = [ + path('admin/', admin.site.urls), + path('', include ('store.urls')) +] diff --git a/ecom/ecom/wsgi.py b/ecom/ecom/wsgi.py new file mode 100644 index 000000000..10cca657d --- /dev/null +++ b/ecom/ecom/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for ecom 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/5.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ecom.settings') + +application = get_wsgi_application() diff --git a/ecom/manage.py b/ecom/manage.py new file mode 100644 index 000000000..85a19c5cd --- /dev/null +++ b/ecom/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ecom.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/ecom/static/css/main.css b/ecom/static/css/main.css new file mode 100644 index 000000000..5bc731bf8 --- /dev/null +++ b/ecom/static/css/main.css @@ -0,0 +1,100 @@ + +body{ + background-color: hsl(0, 0%, 98%); +} + +h1,h2,h3,h4,h5,h6{ + color:hsl(0, 0%, 30%); +} + +.box-element{ + box-shadow:hsl(0, 0%, 80%) 0 0 16px; + background-color: #fff; + border-radius: 4px; + padding: 10px; +} + +.thumbnail{ + width: 100%; + height: 200px; + -webkit-box-shadow: -1px -3px 5px -2px rgba(214,214,214,1); + -moz-box-shadow: -1px -3px 5px -2px rgba(214,214,214,1); + box-shadow: -1px -3px 5px -2px rgba(214,214,214,1); +} + +.product{ + border-radius: 0 0 4px 4px; +} + +.bg-dark{ + background-color: #4f868c!important; +} + +#cart-icon{ + width:25px; + display: inline-block; + margin-left: 15px; +} + +#cart-total{ + display: block; + text-align: center; + color:#fff; + background-color: red; + width: 20px; + height: 25px; + border-radius: 50%; + font-size: 14px; +} + +.col-lg-4, .col-lg-6, .col-lg-8, .col-lg-12{ + margin-top: 10px; +} + +.btn{ + border-radius: 0; +} + +.row-image{ + width: 100px; +} + +.form-field{ + width:250px; + display: inline-block; + padding: 5px; +} + +.cart-row{ + display: flex; + align-items: flex-stretch; + padding-bottom: 10px; + margin-bottom: 10px; + border-bottom: 1px solid #ececec; + +} + +.quantity{ + display: inline-block; + font-weight: 700; + padding-right:10px; + + +} + +.chg-quantity{ + width: 12px; + cursor: pointer; + display: block; + margin-top: 5px; + transition:.1s; +} + +.chg-quantity:hover{ + opacity: .6; +} + + +.hidden{ + display: none!important; +} \ No newline at end of file diff --git a/ecom/static/images/arrow-down.png b/ecom/static/images/arrow-down.png new file mode 100644 index 000000000..c3001d493 Binary files /dev/null and b/ecom/static/images/arrow-down.png differ diff --git a/ecom/static/images/arrow-up.png b/ecom/static/images/arrow-up.png new file mode 100644 index 000000000..058e679cf Binary files /dev/null and b/ecom/static/images/arrow-up.png differ diff --git a/ecom/static/images/cart.png b/ecom/static/images/cart.png new file mode 100644 index 000000000..3f8be4de3 Binary files /dev/null and b/ecom/static/images/cart.png differ diff --git a/ecom/static/images/placeholder.png b/ecom/static/images/placeholder.png new file mode 100644 index 000000000..5f64a715c Binary files /dev/null and b/ecom/static/images/placeholder.png differ diff --git a/ecom/store/__init__.py b/ecom/store/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ecom/store/__pycache__/__init__.cpython-313.pyc b/ecom/store/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 000000000..bdda328b1 Binary files /dev/null and b/ecom/store/__pycache__/__init__.cpython-313.pyc differ diff --git a/ecom/store/__pycache__/admin.cpython-313.pyc b/ecom/store/__pycache__/admin.cpython-313.pyc new file mode 100644 index 000000000..5eb63dc9e Binary files /dev/null and b/ecom/store/__pycache__/admin.cpython-313.pyc differ diff --git a/ecom/store/__pycache__/apps.cpython-313.pyc b/ecom/store/__pycache__/apps.cpython-313.pyc new file mode 100644 index 000000000..3b6d4ace6 Binary files /dev/null and b/ecom/store/__pycache__/apps.cpython-313.pyc differ diff --git a/ecom/store/__pycache__/models.cpython-313.pyc b/ecom/store/__pycache__/models.cpython-313.pyc new file mode 100644 index 000000000..2c338c108 Binary files /dev/null and b/ecom/store/__pycache__/models.cpython-313.pyc differ diff --git a/ecom/store/__pycache__/urls.cpython-313.pyc b/ecom/store/__pycache__/urls.cpython-313.pyc new file mode 100644 index 000000000..539b21807 Binary files /dev/null and b/ecom/store/__pycache__/urls.cpython-313.pyc differ diff --git a/ecom/store/__pycache__/views.cpython-313.pyc b/ecom/store/__pycache__/views.cpython-313.pyc new file mode 100644 index 000000000..03b79b17f Binary files /dev/null and b/ecom/store/__pycache__/views.cpython-313.pyc differ diff --git a/ecom/store/admin.py b/ecom/store/admin.py new file mode 100644 index 000000000..8c38f3f3d --- /dev/null +++ b/ecom/store/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/ecom/store/apps.py b/ecom/store/apps.py new file mode 100644 index 000000000..41658c1eb --- /dev/null +++ b/ecom/store/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class StoreConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'store' diff --git a/ecom/store/migrations/__init__.py b/ecom/store/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/ecom/store/migrations/__pycache__/__init__.cpython-313.pyc b/ecom/store/migrations/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 000000000..92f65b55d Binary files /dev/null and b/ecom/store/migrations/__pycache__/__init__.cpython-313.pyc differ diff --git a/ecom/store/models.py b/ecom/store/models.py new file mode 100644 index 000000000..976b8d53c --- /dev/null +++ b/ecom/store/models.py @@ -0,0 +1,34 @@ +from django.db import models +from django.contrib.auth.models import User + +# Create your models here. + + +class customer(models.Model): + user = models.OneToOneField(User,on_delete=models.CASCADE, null=True,blank=True) + name = models.CharField(max_length=200, null=True) + email = models.CharField(max_length=200 , null=True) + + def __str__(self): + return self.name + + +class Product(models.Model): + name = models.CharField(max_length=200, null=True) + price = models.FloatField() + digital = models.BooleanField(default=True, null=True, blank=False) + + def __str__(self): + return self.name + + +class order(models.Model): + customer = models.ForeignKey(customer, on_delete=models.SET_NULL, blank=True,null=True) + date_ordered = models.DateTimeField(auto_now_add=True) + complete = models.BooleanField(dafault=False, null=True, blank= False) + + def __str__(self): + return str(self.id) + + + diff --git a/ecom/store/templates/store/Main.html b/ecom/store/templates/store/Main.html new file mode 100644 index 000000000..06911eb44 --- /dev/null +++ b/ecom/store/templates/store/Main.html @@ -0,0 +1,67 @@ + +{% load static %} + +
+ + +
Product 1
$20
2
+
+
+
+ $32
+
+
+
+
+
+