Skip to content

Commit

Permalink
New
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh565565 committed Jun 15, 2023
1 parent 7b3b0f3 commit b2976e0
Show file tree
Hide file tree
Showing 52 changed files with 507 additions and 210 deletions.
Binary file modified db.sqlite3
Binary file not shown.
Binary file modified shop/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file modified shop/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file modified shop/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file modified shop/__pycache__/utils.cpython-311.pyc
Binary file not shown.
Binary file modified shop/__pycache__/views.cpython-311.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions shop/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
class ShopConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'shop'

17 changes: 13 additions & 4 deletions shop/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by Django 4.2.2 on 2023-06-09 13:36
# Generated by Django 4.2.2 on 2023-06-12 23:37

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

Expand All @@ -10,7 +9,6 @@ class Migration(migrations.Migration):
initial = True

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

operations = [
Expand All @@ -20,7 +18,17 @@ class Migration(migrations.Migration):
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200, null=True)),
('email', models.CharField(max_length=200)),
('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Fashion',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('details', models.TextField(blank=True, null=True)),
('price', models.FloatField()),
('digital', models.BooleanField(blank=True, default=False, null=True)),
('image', models.ImageField(blank=True, null=True, upload_to='')),
],
),
migrations.CreateModel(
Expand All @@ -38,6 +46,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('details', models.TextField(blank=True, null=True)),
('price', models.FloatField()),
('digital', models.BooleanField(blank=True, default=False, null=True)),
('image', models.ImageField(blank=True, null=True, upload_to='')),
Expand Down
23 changes: 23 additions & 0 deletions shop/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.2 on 2023-06-12 23:37

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),
('shop', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='customer',
name='user',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
18 changes: 0 additions & 18 deletions shop/migrations/0002_product_details.py

This file was deleted.

24 changes: 0 additions & 24 deletions shop/migrations/0003_fashion.py

This file was deleted.

Binary file modified shop/migrations/__pycache__/0001_initial.cpython-311.pyc
Binary file not shown.
Binary file not shown.
9 changes: 7 additions & 2 deletions shop/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver

# Create your models here.

class Customer(models.Model):
user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE)
user = models.OneToOneField(settings.AUTH_USER_MODEL, null=True, blank=True, on_delete=models.CASCADE)
name = models.CharField(max_length=200, null=True)
email = models.CharField(max_length=200)

Expand Down Expand Up @@ -101,4 +104,6 @@ class ShippingAddress(models.Model):
date_added = models.DateTimeField(auto_now_add=True)

def __str__(self):
return self.address
return self.address


5 changes: 2 additions & 3 deletions shop/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from django.urls import path

from .views import *


app_name = "shop"
urlpatterns = [
#Leave as empty string for base url
path('', index, name="index"),
path('cart/', cart, name="cart"),
path('signin/', signin, name="signin"),
path('signup/', signup, name="signup"),
path('checkout/', checkout, name="checkout"),
path('fashion/', fashion, name="fashion"),
path('productdetail/<int:id>/', productdetail, name="productdetail"),
Expand Down
37 changes: 11 additions & 26 deletions shop/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ def index(request):
return render(request, 'index.html', context)


def signin(request):

context = {}
return render(request, 'registration/signin.html', context)


def signup(request):

context = {}
return render(request, 'registration/signup.html', context)




def cart(request):
data = cartData(request)

Expand All @@ -54,18 +40,6 @@ def checkout(request):
return render(request, 'checkout.html', context)


def fashion(request):
data = cartData(request)

cartItems = data['cartItems']
order = data['order']
items = data['items']

fashions = Fashion.objects.all()
context = {'fashions':fashions, 'cartItems':cartItems}
return render(request, 'fashion.html', context)


def productdetail(request, id):
data = cartData(request)
cartItems = data['cartItems']
Expand All @@ -77,6 +51,17 @@ def productdetail(request, id):
context = {'products':products, 'cartItems':cartItems}
return render(request, 'product-detail.html', context)

def fashion(request):
data = cartData(request)

cartItems = data['cartItems']
order = data['order']
items = data['items']

fashions = Fashion.objects.all()
context = {'fashions':fashions, 'cartItems':cartItems}
return render(request, 'fashion.html', context)


def updateItem(request):
data = json.loads(request.body)
Expand Down
Binary file modified smartbuy/__pycache__/settings.cpython-311.pyc
Binary file not shown.
Binary file modified smartbuy/__pycache__/urls.cpython-311.pyc
Binary file not shown.
6 changes: 4 additions & 2 deletions smartbuy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'shop',
'django.contrib.humanize',
'shop',
'userauths',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -125,6 +126,7 @@

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

AUTH_USER_MODEL = 'userauths.User'

STATIC_URL = '/static/'

Expand All @@ -134,4 +136,4 @@

MEDIA_URL = '/images/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'static/images')
MEDIA_ROOT = os.path.join(BASE_DIR, 'static/images')
3 changes: 2 additions & 1 deletion smartbuy/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('shop.urls')),
path('', include('shop.urls', namespace='shop')),
path('user/', include('userauths.urls', namespace='userauths')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
9 changes: 5 additions & 4 deletions static/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
box-sizing: border-box;
}

p{
font-family: 'Roboto', sans-serif;
}

body {
max-width: 1200px;
Expand Down Expand Up @@ -192,7 +189,7 @@ aside img {
display: flex;
width: 900px;
justify-content: center;
margin-top: 503px;
margin-top: 494px;
}

.navigation-auto div {
Expand Down Expand Up @@ -338,6 +335,10 @@ main .second-div-0 .div-1 p {
background-color: rgb(216, 123, 30);
}

.star-div{
position: absolute;
top: 310px;
}

.checked {
color: orange;
Expand Down
18 changes: 16 additions & 2 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,29 @@ header {
margin: auto;
width: 1200px;
height: 80px;
display: flex;
align-items: center;
background-color: #EEEEEE;
/* padding: 0px 20px 0px 20px; */
position: fixed;
z-index: 2;
}
.header-1 {
margin: auto;
/* width: 1200px; */
height: 80px;
display: flex;
align-items: center;
padding: 0px 20px 0px 20px;
position: fixed;
/* margin-top: 50px; */
z-index: 2;
}

.alert{
margin-top: 70px;
}
.alert strong{
font-size: 18px;
}
header .logo-div a img {
width: 162px;
height: 36px;
Expand Down
5 changes: 3 additions & 2 deletions static/css/product-detail.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

.div{
position: absolute;
top: 190px;
top: 0px;
}

.div-content{
Expand Down Expand Up @@ -55,7 +55,7 @@ color: yellow;


.price-div {
margin-top:10px;
margin-top:210px;
}

strong{
Expand All @@ -67,6 +67,7 @@ strong{
width: 25px;
}


.a-t-c{
width: 307px;
height: 55px;
Expand Down
Loading

0 comments on commit b2976e0

Please sign in to comment.