-
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.
Showing
18 changed files
with
223 additions
and
0 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
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,10 @@ | ||
# Django | ||
from django.contrib import admin | ||
|
||
# local Django | ||
from .models import Order, OrderProduct | ||
|
||
# Register your models here. | ||
|
||
admin.site.register(Order) | ||
admin.site.register(OrderProduct) |
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 OrderConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'order' |
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,41 @@ | ||
# Generated by Django 3.2.9 on 2021-11-18 05:07 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('payment', '0001_initial'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Order', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('order_number', models.CharField(max_length=20)), | ||
('full_name', models.CharField(max_length=50)), | ||
('phone', models.CharField(max_length=15)), | ||
('email', models.EmailField(max_length=50)), | ||
('house_no', models.CharField(max_length=255, verbose_name='House no, Building, Company')), | ||
('area', models.CharField(max_length=255, verbose_name='Area, Street, Sector, Village')), | ||
('landmark', models.CharField(max_length=50)), | ||
('town', models.CharField(max_length=50, verbose_name='Town/City')), | ||
('state', models.CharField(max_length=50)), | ||
('city', models.CharField(max_length=50)), | ||
('order_total', models.FloatField()), | ||
('tax', models.FloatField()), | ||
('is_ordered', models.BooleanField(default=False)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
('payment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='payment.payment')), | ||
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, 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,43 @@ | ||
# Generated by Django 3.2.9 on 2021-11-18 05:19 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('payment', '0001_initial'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('store', '0001_initial'), | ||
('order', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='order', | ||
name='area', | ||
field=models.CharField(max_length=255, verbose_name='Area/Street/Sector/Village'), | ||
), | ||
migrations.AlterField( | ||
model_name='order', | ||
name='house_no', | ||
field=models.CharField(max_length=255, verbose_name='House no/Building/Company'), | ||
), | ||
migrations.CreateModel( | ||
name='OrderProduct', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('quantity', models.IntegerField()), | ||
('price', models.FloatField()), | ||
('ordered', models.BooleanField(default=False)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now=True)), | ||
('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='order.order')), | ||
('payment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='payment.payment')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
('variant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='store.variant')), | ||
], | ||
), | ||
] |
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,49 @@ | ||
# Django | ||
from django.db import models | ||
from django.contrib.auth import get_user_model | ||
|
||
# local Django | ||
from payment.models import Payment | ||
from cart.models import Variant | ||
|
||
# Create your models here. | ||
|
||
User = get_user_model() | ||
|
||
|
||
class Order(models.Model): | ||
user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) | ||
payment = models.ForeignKey(Payment, on_delete=models.SET_NULL, blank=True, null=True) | ||
order_number = models.CharField(max_length=20) | ||
full_name = models.CharField(max_length=50) | ||
phone = models.CharField(max_length=15) | ||
email = models.EmailField(max_length=50) | ||
house_no = models.CharField(max_length=255, verbose_name='House no/Building/Company') | ||
area = models.CharField(max_length=255, verbose_name='Area/Street/Sector/Village') | ||
landmark = models.CharField(max_length=50) | ||
town = models.CharField(max_length=50, verbose_name='Town/City') | ||
state = models.CharField(max_length=50) | ||
city = models.CharField(max_length=50) | ||
order_total = models.FloatField() | ||
tax = models.FloatField() | ||
is_ordered = models.BooleanField(default=False) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
|
||
def __str__(self): | ||
return self.user.name | ||
|
||
|
||
class OrderProduct(models.Model): | ||
user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
order = models.ForeignKey(Order, on_delete=models.CASCADE) | ||
payment = models.ForeignKey(Payment, on_delete=models.SET_NULL, blank=True, null=True) | ||
variant = models.ForeignKey(Variant, on_delete=models.CASCADE) | ||
quantity = models.IntegerField() | ||
price = models.FloatField() | ||
ordered = models.BooleanField(default=False) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
|
||
def __str__(self): | ||
return self.variant.slug |
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. |
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,9 @@ | ||
# Django | ||
from django.contrib import admin | ||
|
||
# local Django | ||
from .models import Payment | ||
|
||
# Register your models here. | ||
|
||
admin.site.register(Payment) |
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 PaymentConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'payment' |
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,29 @@ | ||
# Generated by Django 3.2.9 on 2021-11-18 04:44 | ||
|
||
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='Payment', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('payment_id', models.CharField(max_length=255)), | ||
('payment_method', models.CharField(max_length=255)), | ||
('amount_paid', models.CharField(max_length=255)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('status', models.BooleanField(default=False)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
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,16 @@ | ||
# Django | ||
from django.db import models | ||
from django.contrib.auth import get_user_model | ||
|
||
# Create your models here. | ||
|
||
User = get_user_model() | ||
|
||
|
||
class Payment(models.Model): | ||
user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
payment_id = models.CharField(max_length=255) | ||
payment_method = models.CharField(max_length=255) | ||
amount_paid = models.CharField(max_length=255) | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
status = models.BooleanField(default=False) |
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. |