-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/add-tests
- Loading branch information
Showing
137 changed files
with
3,950 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ContactConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'Contact' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,9 @@ | |
"Auth.apps.AuthConfig", | ||
"Shop.apps.ShopConfig", | ||
"add_to_cart.apps.AddToCartConfig", | ||
"userprofile.apps.UserprofileConfig" | ||
'payments.apps.PaymentsConfig', | ||
"userprofile.apps.UserprofileConfig", | ||
"Support" | ||
] | ||
|
||
MIDDLEWARE = [ | ||
|
@@ -145,3 +147,23 @@ | |
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field | ||
|
||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' | ||
|
||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | ||
EMAIL_HOST = 'smtp.example.com' | ||
EMAIL_PORT = 587 | ||
EMAIL_USE_TLS = True | ||
EMAIL_HOST_USER = '[email protected]' | ||
EMAIL_HOST_PASSWORD = 'admin' | ||
DEFAULT_FROM_EMAIL = '[email protected]' | ||
# myproject/settings.py | ||
|
||
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__))) | ||
|
||
# Add these lines at the end of your settings.py file | ||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') | ||
MEDIA_URL = '/media/' | ||
|
||
STRIPE_SECRET_KEY = 'sk_test_51PaOOhRtHtPlgcaiSwH19QRY2pMB1G3HYzLZhI5HnX7GwYt4XBxCJ1U9mE3yyFaVPlYobaM4nF1Qn6wzOC1INrjz00c3EnnK05' | ||
STRIPE_PUBLISHABLE_KEY = 'pk_test_51PaOOhRtHtPlgcaiDlSzoNrhdvbuxI0pjDgLiFgH53Nbch8hjwCNiFIinLLZUUKSA9IhA7dnGyKnBl4qWEI2miDy00H3IE7lGy' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,91 @@ | ||
{% load static %} | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<script src="https://cdn.tailwindcss.com/"></script> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> | ||
<link rel="stylesheet" href="{% static 'css/app.css' %}"> | ||
|
||
<title>{% block title %}{% endblock %}</title> | ||
<style> | ||
html, body { | ||
html, | ||
body { | ||
height: 100%; | ||
} | ||
|
||
.scroll-container { | ||
height: calc(100% - 6rem); /* Adjust based on your header height */ | ||
height: calc(100% - 6rem); | ||
/* Adjust based on your header height */ | ||
overflow-y: auto; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body class="flex flex-col min-h-screen"> | ||
<!-- Top section: Header --> | ||
<div> | ||
{% include 'alert.html' %} | ||
<nav class="px-6 py-6 flex justify-between items-center border-b border-gray-200"> | ||
<!-- Left side: GreenCart logo/image and search field --> | ||
<div class="flex items-center"> | ||
<!-- GreenCart logo/image (replace with your image or text) --> | ||
<a href="/" class="flex items-center mb-4 sm:mb-0 space-x-3 rtl:space-x-reverse"> | ||
<img src="{% static 'images/logo.png' %}" class="h-8" alt="GreenCart Logo" /> | ||
<span class="self-center text-xl font-semibold whitespace-nowrap text-green-600">GreenCart</span> | ||
</a> | ||
<form method="GET" class="ml-4 flex"> | ||
<div class="flex"> | ||
<input type="text" name="query" placeholder="Search for a product" class="py-1 px-2 sm:px-4 rounded-l-lg border border-gray-300 focus:outline-none focus:border-green-600 w-full sm:w-auto "> | ||
<button type="submit" class="py-1 px-3 bg-green-600 text-white rounded-r-lg hover:bg-green-700 focus:outline-none focus:bg-green-700">Search</button> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
<!-- Right side: Navigation links --> | ||
<ul class="flex space-x-4"> | ||
<li><a href="{% url 'GreenCartEcom:index' %}" class="text-gray-500">Home</a></li> | ||
<li><a href="{% url 'GreenCartEcom:contact' %}" class="text-gray-500">Contact</a></li> | ||
<li><a href="{% url 'Auth:login' %}" class="text-gray-500">SignIn</a></li> | ||
{# <li><a href="{% url 'AddToCart:cart' %}" class="text-gray-500">Cart</a></li>#} | ||
</ul> | ||
</nav> | ||
<div class="sticky top-0 z-50"> | ||
<div class="bg-white shadow-lg"> | ||
{% include 'alert.html' %} | ||
<nav class="px-6 py-6 flex bg-green-100/75 justify-between items-center border-b border-gray-200"> | ||
<!-- Left side: GreenCart logo/image and search field --> | ||
<div class="flex items-center"> | ||
<!-- GreenCart logo/image (replace with your image or text) --> | ||
<a href="/" class="flex items-center mb-4 sm:mb-0 space-x-3 rtl:space-x-reverse"> | ||
<img src="{% static 'images/logo.png' %}" class="h-8" alt="GreenCart Logo" /> | ||
</a> | ||
<form method="GET" class="ml-4 flex items-center"> | ||
<div class="flex"> | ||
<input type="text" name="query" placeholder="Search for a product" | ||
class="h-10 py-1 px-2 sm:px-4 rounded-l-lg border border-gray-300 focus:outline-none focus:border-green-600 w-64 sm:w-96"> | ||
<!-- Adjusted the height to 12 and width to 64/96 --> | ||
<button type="submit" | ||
class="h-10 py-2 px-4 bg-green-600 text-white rounded-r-lg hover:bg-green-700 focus:outline-none focus:bg-green-700">Search</button> | ||
<!-- Adjusted the height to 12 --> | ||
</div> | ||
</form> | ||
</div> | ||
|
||
<!-- Right side: Navigation links --> | ||
<ul class="flex space-x-4"> | ||
<!-- <li><a href="{% url 'GreenCartEcom:contact' %}" class="pr-4 text-green-500/50 hover:text-green-600 text-lg font-semibold">Contact</a></li> --> | ||
<li><a href="{% url 'Auth:login' %}" | ||
class="pr-4 text-green-500/50 hover:text-green-600 text-lg font-semibold">SignIn</a></li> | ||
</ul> | ||
</nav> | ||
</div> | ||
</div> | ||
<!-- Navigation bar for categories --> | ||
<nav class="bg-white shadow-lg px-4"> | ||
<div class="flex justify-between h-14"> | ||
<div class="flex"> | ||
<div class="hidden sm:flex sm:space-x-8"> | ||
{% for category in navCategories %} | ||
<a href="#" class="border-b-2 border-transparent text-gray-900 inline-flex items-center px-1 pt-1 text-sm font-medium hover:border-gray-300">{{ category.title }}</a> | ||
{% endfor %} | ||
<div class="flex"> | ||
<div class="hidden sm:flex sm:space-x-8"> | ||
{% for category in navCategories %} | ||
<a href="#" | ||
class="border-b-2 border-transparent text-gray-900 inline-flex items-center px-1 pt-1 text-md font-medium hover:border-gray-300">{{ category.title }}</a> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> | ||
</nav> | ||
|
||
<!-- Main content section with scrollbar --> | ||
<div class="flex flex-col flex-grow"> | ||
<div class="scroll-container flex-grow overflow-y-auto"> | ||
<div class="scroll-container flex-grow overflow-y-auto mt-14"> | ||
<!-- Add margin-top to prevent content from overlapping with the header --> | ||
{% block content %} | ||
{% endblock %} | ||
</div> | ||
|
||
<!-- Footer section --> | ||
<footer class="bg-gray-800 text-white py-4 flex-shrink-0"> | ||
<footer class="text-black py-4 flex-shrink-0"> | ||
{% include 'footer.html' %} | ||
</footer> | ||
</div> | ||
|
||
<script src="{% static 'js/setTimeoutForAlert.js' %}"> </script> | ||
</body> | ||
</html> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Product,Reviews | ||
# Register your models here. | ||
|
||
from .models import Product | ||
|
||
admin.site.register(Product) | ||
admin.site.register(Product) | ||
admin.site.register(Reviews) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# forms.py | ||
|
||
from django import forms | ||
from .models import Product | ||
|
||
class ProductForm(forms.ModelForm): | ||
class Meta: | ||
model = Product | ||
fields = [ | ||
'name', 'description', 'price', 'expiry', | ||
'discount_price', 'image', 'in_stock', | ||
'rating' | ||
] | ||
widgets = { | ||
'name': forms.TextInput(attrs={'class': 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500', 'placeholder': 'Sun flower', 'required': True}), | ||
'description': forms.Textarea(attrs={'class': 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500', 'placeholder': 'Description', 'rows': 3}), | ||
'price': forms.NumberInput(attrs={'class': 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500', 'placeholder': '0.00', 'step': '0.01', 'required': True}), | ||
'expiry': forms.NumberInput(attrs={'class': 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500', 'placeholder': '0', 'min': 0}), | ||
'discount_price': forms.NumberInput(attrs={'class': 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500', 'placeholder': '0.00', 'step': '0.01'}), | ||
'image': forms.ClearableFileInput(attrs={'class': 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500'}), | ||
'in_stock': forms.CheckboxInput(attrs={'class': 'sr-only peer', 'id': 'in_stock_toggle'}), # Hidden checkbox | ||
'rating': forms.NumberInput(attrs={'class': 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500', 'placeholder': '0.0', 'step': '0.01', 'min': 0, 'max': 5}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.13 on 2024-06-30 05:26 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('Shop', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='product', | ||
name='expiry', | ||
field=models.IntegerField(default=3), | ||
), | ||
] |
Oops, something went wrong.