-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sunny
committed
Apr 17, 2021
1 parent
c759deb
commit 0f1861d
Showing
32 changed files
with
394 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
shell = "*" | ||
django = "*" | ||
pillow = "*" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.7" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,3 +1,26 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from .models import( | ||
Customer, | ||
Product, | ||
Cart, | ||
OrderPlaced, | ||
) | ||
|
||
@admin.register(Customer) | ||
class CustomerModelAdmin(admin.ModelAdmin): | ||
list_display = ['id','user','name','locality','city','zipcode','state'] | ||
|
||
@admin.register(Product) | ||
class ProductModelAdmin(admin.ModelAdmin): | ||
list_display = ['id','title','selling_price','discount_price','description','brand','category','product_image'] | ||
|
||
@admin.register(Cart) | ||
class CartModelAdmin(admin.ModelAdmin): | ||
list_display = ['id','user','product','quantity'] | ||
|
||
|
||
@admin.register(OrderPlaced) | ||
class OrderPlacedModelAdmin(admin.ModelAdmin): | ||
list_display = ['id','user','customer','product','quantity','order_date','status'] |
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,63 @@ | ||
# Generated by Django 3.2 on 2021-04-16 15:59 | ||
|
||
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='Customer', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=100)), | ||
('locality', models.CharField(max_length=100)), | ||
('city', models.CharField(max_length=100)), | ||
('zipcode', models.IntegerField()), | ||
('state', models.CharField(choices=[('Andaman & Nikobar', 'Andaman & Nikobar'), ('Andhra Pradesh', 'Andhra Pradesh'), ('Assam', 'Assam'), ('Bihar', 'Bihar'), ('Chandigarh', 'Chandigarh'), ('Delhi', 'delhi'), ('Punjab', 'Punjab')], max_length=100)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Product', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=100)), | ||
('selling_price', models.FloatField()), | ||
('discount_price', models.FloatField()), | ||
('description', models.TextField()), | ||
('Brand', models.CharField(max_length=100)), | ||
('category', models.CharField(choices=[('M', 'Mobile'), ('L', 'Leptop'), ('TW', 'Top Wear'), ('BW', 'Bottom Wear')], max_length=2)), | ||
('product_image', models.ImageField(upload_to='productimg')), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='OrederPlaced', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('quantity', models.PositiveIntegerField(default=1)), | ||
('order_date', models.DateTimeField(auto_now_add=True)), | ||
('status', models.CharField(choices=[('Accepted', 'Accepted'), ('Packed', 'Packed'), ('On The Way', 'On The Way'), ('Delivered', 'delivered'), ('Cancel', 'Cancel')], default='Pending', max_length=50)), | ||
('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.customer')), | ||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.product')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Cart', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('quantity', models.PositiveIntegerField(default=1)), | ||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.product')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
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,24 @@ | ||
# Generated by Django 3.2 on 2021-04-16 16:20 | ||
|
||
from django.conf import settings | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('app', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name='OrederPlaced', | ||
new_name='OrderPlaced', | ||
), | ||
migrations.RenameField( | ||
model_name='product', | ||
old_name='Brand', | ||
new_name='brand', | ||
), | ||
] |
Binary file not shown.
Binary file added
BIN
+704 Bytes
shoppinglyx/app/migrations/__pycache__/0002_auto_20210416_2150.cpython-37.pyc
Binary file not shown.
Binary file not shown.
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,3 +1,71 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
from django.core.validators import MaxValueValidator,MinValueValidator | ||
# Create your models here. | ||
|
||
# Create your models here. | ||
STATE_CHOICE =( | ||
('Andaman & Nikobar','Andaman & Nikobar'), | ||
('Andhra Pradesh','Andhra Pradesh'), | ||
('Assam','Assam'), | ||
('Bihar','Bihar'), | ||
('Chandigarh','Chandigarh'), | ||
('Delhi','delhi'), | ||
('Punjab','Punjab'), | ||
) | ||
|
||
class Customer(models.Model): | ||
user = models.ForeignKey(User, on_delete = models.CASCADE) | ||
name = models.CharField(max_length=100) | ||
locality = models.CharField(max_length=100) | ||
city= models.CharField(max_length=100) | ||
zipcode = models.IntegerField() | ||
state = models.CharField(choices=STATE_CHOICE, max_length=100) | ||
|
||
def __str__(self): | ||
return str(self.id) | ||
|
||
CATEGORY_CHOICES = ( | ||
('M','Mobile'), | ||
('L','Leptop'), | ||
('TW',"Top Wear"), | ||
('BW','Bottom Wear') | ||
) | ||
|
||
class Product(models.Model): | ||
title = models.CharField(max_length=100) | ||
selling_price = models.FloatField() | ||
discount_price = models.FloatField() | ||
description = models.TextField() | ||
brand = models.CharField(max_length=100) | ||
category = models.CharField(choices = CATEGORY_CHOICES,max_length=2) | ||
product_image = models.ImageField(upload_to='productimg') | ||
|
||
def __str__(self): | ||
return str(self.id) | ||
|
||
|
||
|
||
class Cart(models.Model): | ||
user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
product = models.ForeignKey(Product, on_delete=models.CASCADE) | ||
quantity = models.PositiveIntegerField(default=1) | ||
|
||
def __str__(self): | ||
return str(self.id) | ||
|
||
|
||
STATUS_CHOICES = ( | ||
('Accepted','Accepted'), | ||
('Packed','Packed'), | ||
('On The Way','On The Way'), | ||
('Delivered','delivered'), | ||
('Cancel','Cancel') | ||
) | ||
|
||
class OrderPlaced(models.Model): | ||
user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
customer = models.ForeignKey(Customer, on_delete=models.CASCADE) | ||
product = models.ForeignKey(Product, on_delete=models.CASCADE) | ||
quantity = models.PositiveIntegerField(default=1) | ||
order_date = models.DateTimeField(auto_now_add=True) | ||
status = models.CharField(max_length=50, choices=STATUS_CHOICES, default='Pending') |
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
Oops, something went wrong.