Made changes on models

parent 56fea83d
## Retrieved March 22 2022 from https://github.com/github/gitignore/blob/master/Python.gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# Visual Studio Code
settings.json
# PyCharm
.idea/
# Database files
*.dump
\ No newline at end of file
# Generated by Django 3.2.12 on 2022-11-04 19:44
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SalesAgent',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
],
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='salesagent',
name='id',
),
migrations.AddField(
model_name='salesagent',
name='agent_id',
field=models.AutoField(default=1, primary_key=True, serialize=False),
preserve_default=False,
),
migrations.AlterModelTable(
name='salesagent',
table='sales_agent',
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_delete_customer'),
('adminpage', '0002_auto_20221105_0412'),
]
operations = [
migrations.DeleteModel(
name='SalesAgent',
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:18
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('adminpage', '0003_delete_salesagent'),
]
operations = [
migrations.CreateModel(
name='SalesAgent',
fields=[
('agent_id', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
],
options={
'db_table': 'sales_agent',
},
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0005_delete_customer'),
('adminpage', '0004_salesagent'),
]
operations = [
migrations.DeleteModel(
name='SalesAgent',
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:22
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('adminpage', '0005_delete_salesagent'),
]
operations = [
migrations.CreateModel(
name='SalesAgent',
fields=[
('agent_id', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
],
options={
'db_table': 'sales_agent',
},
),
]
# Generated by Django 3.2.12 on 2022-11-04 21:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0006_salesagent'),
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('item_id', models.AutoField(primary_key=True, serialize=False)),
('item_name', models.CharField(max_length=50)),
('personalization', models.CharField(max_length=254)),
('color', models.CharField(max_length=20)),
('price', models.IntegerField()),
('collection', models.CharField(max_length=50)),
],
options={
'db_table': 'product',
},
),
]
# Generated by Django 3.2.12 on 2022-11-07 22:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0007_product'),
]
operations = [
migrations.CreateModel(
name='Folder',
fields=[
('folder_id', models.AutoField(primary_key=True, serialize=False)),
('length', models.PositiveIntegerField(help_text='in centimeters')),
('width', models.PositiveIntegerField(help_text='in centimeters')),
('thickness', models.PositiveIntegerField(help_text='in centimeters')),
],
options={
'db_table': 'folder',
},
),
migrations.CreateModel(
name='PenOrganizer',
fields=[
('pen_org_id', models.AutoField(primary_key=True, serialize=False)),
('slots', models.PositiveIntegerField(help_text='in centimeters')),
],
options={
'db_table': 'pen_organizer',
},
),
migrations.CreateModel(
name='Planner',
fields=[
('planner_id', models.AutoField(primary_key=True, serialize=False)),
('length', models.PositiveIntegerField(help_text='in centimeters')),
('width', models.PositiveIntegerField(help_text='in centimeters')),
('thickness', models.PositiveIntegerField(help_text='in centimeters')),
],
options={
'db_table': 'planner',
},
),
migrations.AlterField(
model_name='product',
name='collection',
field=models.CharField(choices=[('F', 'Folder'), ('PO', 'Pen Organizer'), ('P', 'Planner')], max_length=20),
),
migrations.AlterField(
model_name='product',
name='price',
field=models.PositiveIntegerField(help_text='in pesos'),
),
migrations.CreateModel(
name='Feature',
fields=[
('feature_id', models.AutoField(primary_key=True, serialize=False)),
('feature', models.CharField(max_length=50)),
('item_id', models.ForeignKey(db_column='item_id', on_delete=django.db.models.deletion.CASCADE, to='adminpage.product')),
],
options={
'db_table': 'feature',
},
),
]
# Generated by Django 3.2.12 on 2022-11-07 23:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0008_auto_20221108_0657'),
]
operations = [
migrations.AlterField(
model_name='product',
name='color',
field=models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20),
),
]
# Generated by Django 3.2.12 on 2022-11-07 23:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0014_auto_20221108_0745'),
('adminpage', '0009_alter_product_color'),
]
operations = [
migrations.RemoveField(
model_name='feature',
name='item_id',
),
migrations.DeleteModel(
name='Folder',
),
migrations.DeleteModel(
name='PenOrganizer',
),
migrations.DeleteModel(
name='Planner',
),
migrations.DeleteModel(
name='SalesAgent',
),
migrations.DeleteModel(
name='Feature',
),
migrations.DeleteModel(
name='Product',
),
]
# Generated by Django 3.2.12 on 2022-11-07 23:45
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('adminpage', '0010_auto_20221108_0745'),
]
operations = [
migrations.CreateModel(
name='Feature',
fields=[
('feature_id', models.AutoField(primary_key=True, serialize=False)),
('feature', models.CharField(max_length=50)),
],
options={
'db_table': 'feature',
},
),
migrations.CreateModel(
name='Folder',
fields=[
('item_id', models.AutoField(primary_key=True, serialize=False)),
('item_name', models.CharField(max_length=50)),
('personalization', models.CharField(max_length=254)),
('color', models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20)),
('price', models.PositiveIntegerField(help_text='in pesos')),
('collection', models.CharField(default='F', editable=False, max_length=20)),
('length', models.PositiveIntegerField(help_text='in inches')),
('width', models.PositiveIntegerField(help_text='in inches')),
('thickness', models.PositiveIntegerField(help_text='in inches')),
],
options={
'db_table': 'folder',
},
),
migrations.CreateModel(
name='PenOrganizer',
fields=[
('item_id', models.AutoField(primary_key=True, serialize=False)),
('item_name', models.CharField(max_length=50)),
('personalization', models.CharField(max_length=254)),
('color', models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20)),
('price', models.PositiveIntegerField(help_text='in pesos')),
('collection', models.CharField(default='PO', editable=False, max_length=20)),
('slots', models.PositiveIntegerField()),
],
options={
'db_table': 'pen_organizer',
},
),
migrations.CreateModel(
name='Planner',
fields=[
('item_name', models.CharField(max_length=50)),
('personalization', models.CharField(max_length=254)),
('color', models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20)),
('price', models.PositiveIntegerField(help_text='in pesos')),
('item_id', models.AutoField(primary_key=True, serialize=False)),
('collection', models.CharField(default='P', editable=False, max_length=20)),
('length', models.PositiveIntegerField(help_text='in inches')),
('width', models.PositiveIntegerField(help_text='in inches')),
('thickness', models.PositiveIntegerField(help_text='in inches')),
],
options={
'db_table': 'planner',
},
),
migrations.CreateModel(
name='SalesAgent',
fields=[
('agent_id', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
],
options={
'db_table': 'sales_agent',
},
),
]
# Generated by Django 3.2.12 on 2022-11-18 10:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0011_feature_folder_penorganizer_planner_salesagent'),
]
operations = [
migrations.DeleteModel(
name='Planner',
),
migrations.AlterField(
model_name='folder',
name='length',
field=models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10),
),
migrations.AlterField(
model_name='folder',
name='thickness',
field=models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10),
),
migrations.AlterField(
model_name='folder',
name='width',
field=models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10),
),
]
# Generated by Django 3.2.12 on 2022-11-18 10:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0012_auto_20221118_1849'),
]
operations = [
migrations.CreateModel(
name='Planner',
fields=[
('item_id', models.AutoField(primary_key=True, serialize=False)),
('item_name', models.CharField(max_length=50)),
('personalization', models.CharField(max_length=254)),
('color', models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20)),
('price', models.PositiveIntegerField(help_text='in pesos')),
('collection', models.CharField(default='P', editable=False, max_length=20)),
('length', models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10)),
('width', models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10)),
('thickness', models.DecimalField(decimal_places=2, help_text='in inches', max_digits=10)),
],
options={
'db_table': 'planner',
},
),
]
# Generated by Django 3.2.12 on 2022-11-18 11:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0013_planner'),
]
operations = [
migrations.CreateModel(
name='Description',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('feature_item_id', models.ForeignKey(db_column='feature_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.feature')),
('folder_id', models.ForeignKey(db_column='folder_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.folder')),
('pen_organizer_id', models.ForeignKey(db_column='pen_organizer_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.penorganizer')),
('planner_id', models.ForeignKey(db_column='planner_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.planner')),
],
),
]
# Generated by Django 3.2.12 on 2022-11-18 11:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0014_description'),
]
operations = [
migrations.AlterModelTable(
name='description',
table='desciption',
),
]
# Generated by Django 3.2.12 on 2022-11-04 19:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('adminpage', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('sales_agent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')),
],
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='customer',
name='id',
),
migrations.AddField(
model_name='customer',
name='customer_id',
field=models.AutoField(default=1, primary_key=True, serialize=False),
preserve_default=False,
),
migrations.AlterModelTable(
name='customer',
table='customer',
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_auto_20221105_0412'),
]
operations = [
migrations.DeleteModel(
name='Customer',
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('adminpage', '0004_salesagent'),
('homepage', '0003_delete_customer'),
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('customer_id', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('sales_agent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')),
],
options={
'db_table': 'customer',
},
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0004_customer'),
]
operations = [
migrations.DeleteModel(
name='Customer',
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('adminpage', '0006_salesagent'),
('homepage', '0005_delete_customer'),
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('customer_id', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('sales_agent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')),
],
options={
'db_table': 'customer',
},
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0006_customer'),
]
operations = [
migrations.DeleteModel(
name='Customer',
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('adminpage', '0006_salesagent'),
('homepage', '0007_delete_customer'),
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('customer_id', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('agent_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')),
],
options={
'db_table': 'customer',
},
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0008_customer'),
]
operations = [
migrations.DeleteModel(
name='Customer',
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('adminpage', '0006_salesagent'),
('homepage', '0009_delete_customer'),
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
('customer_id', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('agent_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent', verbose_name='agent_id')),
],
options={
'db_table': 'customer',
},
),
]
# Generated by Django 3.2.12 on 2022-11-04 20:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0006_salesagent'),
('homepage', '0010_customer'),
]
operations = [
migrations.AlterField(
model_name='customer',
name='agent_id',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent'),
),
migrations.CreateModel(
name='Order',
fields=[
('Order_no', models.AutoField(primary_key=True, serialize=False)),
('Order_date', models.DateField(auto_now_add=True)),
('delivery_date', models.DateField()),
('delivery_address', models.CharField(max_length=254)),
('gift', models.BooleanField()),
('recipient', models.CharField(max_length=50)),
('agent_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')),
('customer_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.customer')),
],
),
]
# Generated by Django 3.2.12 on 2022-11-04 21:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0006_salesagent'),
('homepage', '0011_auto_20221105_0453'),
]
operations = [
migrations.AlterField(
model_name='customer',
name='agent_id',
field=models.ForeignKey(db_column='agent_id', on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent'),
),
migrations.AlterField(
model_name='order',
name='agent_id',
field=models.ForeignKey(db_column='agent_id', on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent'),
),
migrations.AlterField(
model_name='order',
name='customer_id',
field=models.ForeignKey(db_column='customer_id', on_delete=django.db.models.deletion.CASCADE, to='homepage.customer'),
),
migrations.AlterModelTable(
name='order',
table='order',
),
]
# Generated by Django 3.2.12 on 2022-11-04 21:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0007_product'),
('homepage', '0012_auto_20221105_0503'),
]
operations = [
migrations.AddField(
model_name='order',
name='amount_due',
field=models.IntegerField(default=0, editable=False),
),
migrations.CreateModel(
name='OrderItem',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('personalization', models.CharField(max_length=254)),
('discount', models.IntegerField(default=0)),
('discount_price', models.IntegerField(default=0)),
('item_id', models.ForeignKey(db_column='item_id', on_delete=django.db.models.deletion.CASCADE, to='adminpage.product')),
('order_no', models.ForeignKey(db_column='agent_id', on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')),
],
options={
'db_table': 'order_item',
},
),
]
# Generated by Django 3.2.12 on 2022-11-07 23:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0013_auto_20221105_0530'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='agent_id',
),
migrations.RemoveField(
model_name='order',
name='customer_id',
),
migrations.RemoveField(
model_name='orderitem',
name='item_id',
),
migrations.RemoveField(
model_name='orderitem',
name='order_no',
),
migrations.DeleteModel(
name='Customer',
),
migrations.DeleteModel(
name='Order',
),
migrations.DeleteModel(
name='OrderItem',
),
]
# Generated by Django 3.2.12 on 2022-11-08 00:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0011_feature_folder_penorganizer_planner_salesagent'),
('homepage', '0015_customer_order_orderitem'),
]
operations = [
migrations.AddField(
model_name='orderitem',
name='items',
field=models.ManyToManyField(to='adminpage.Folder'),
),
]
# Generated by Django 3.2.12 on 2022-11-08 02:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('adminpage', '0011_feature_folder_penorganizer_planner_salesagent'),
('homepage', '0016_orderitem_items'),
]
operations = [
migrations.RemoveField(
model_name='orderitem',
name='items',
),
migrations.AddField(
model_name='order',
name='items',
field=models.ManyToManyField(through='homepage.OrderItem', to='adminpage.Folder'),
),
migrations.AddField(
model_name='orderitem',
name='item_id',
field=models.ForeignKey(db_column='item_id', default=1, on_delete=django.db.models.deletion.CASCADE, to='adminpage.folder'),
preserve_default=False,
),
migrations.AddField(
model_name='orderitem',
name='quantity',
field=models.IntegerField(default=1),
),
migrations.AlterField(
model_name='orderitem',
name='discount',
field=models.IntegerField(default=0, editable=False),
),
migrations.AlterField(
model_name='orderitem',
name='discount_price',
field=models.IntegerField(default=0, editable=False),
),
migrations.AlterField(
model_name='orderitem',
name='order_no',
field=models.ForeignKey(db_column='order_no', on_delete=django.db.models.deletion.CASCADE, to='homepage.order'),
),
]
from django.contrib import admin from django.contrib import admin
from .models import Customer, Order, OrderItem from .models import Order, OrderItem
# Register your models here. # Register your models here.
class CustomerAdmin(admin.ModelAdmin):
model = Customer
class OrderAdmin(admin.ModelAdmin): class OrderAdmin(admin.ModelAdmin):
model = Order model = Order
...@@ -12,6 +9,5 @@ class OrderItemAdmin(admin.ModelAdmin): ...@@ -12,6 +9,5 @@ class OrderItemAdmin(admin.ModelAdmin):
model = OrderItem model = OrderItem
admin.site.register(Customer, CustomerAdmin)
admin.site.register(Order, OrderAdmin) admin.site.register(Order, OrderAdmin)
admin.site.register(OrderItem, OrderItemAdmin) admin.site.register(OrderItem, OrderItemAdmin)
\ No newline at end of file
from django.apps import AppConfig from django.apps import AppConfig
class HomepageConfig(AppConfig): class OrdersConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField' default_auto_field = 'django.db.models.BigAutoField'
name = 'homepage' name = 'orders'
# Generated by Django 3.2.12 on 2022-11-07 23:45 # Generated by Django 3.2.12 on 2022-11-20 02:03
import django.core.validators
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
...@@ -9,51 +10,46 @@ class Migration(migrations.Migration): ...@@ -9,51 +10,46 @@ class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [
('adminpage', '0011_feature_folder_penorganizer_planner_salesagent'), ('users', '0001_initial'),
('homepage', '0014_auto_20221108_0745'), ('products', '0001_initial'),
] ]
operations = [ operations = [
migrations.CreateModel( migrations.CreateModel(
name='Customer', name='Order',
fields=[ fields=[
('customer_id', models.AutoField(primary_key=True, serialize=False)), ('order_no', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=50)), ('order_date', models.DateField(auto_now_add=True)),
('last_name', models.CharField(max_length=50)), ('delivery_schedule', models.DateTimeField()),
('agent_id', models.ForeignKey(db_column='agent_id', on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')), ('delivery_address', models.CharField(max_length=254)),
('gift', models.BooleanField()),
('recipient', models.CharField(max_length=50)),
('amount_due', models.IntegerField(default=0, editable=False)),
('customer_id', models.ForeignKey(db_column='customer_id', on_delete=django.db.models.deletion.CASCADE, to='users.customer')),
], ],
options={ options={
'db_table': 'customer', 'db_table': 'order',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='OrderItem', name='OrderItem',
fields=[ fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('color', models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20)),
('quantity', models.IntegerField(default=1, validators=[django.core.validators.MaxValueValidator(99), django.core.validators.MinValueValidator(0)])),
('personalization', models.CharField(max_length=254)), ('personalization', models.CharField(max_length=254)),
('discount', models.IntegerField(default=0)), ('discount', models.IntegerField(default=0, editable=False)),
('discount_price', models.IntegerField(default=0)), ('discount_price', models.IntegerField(default=0, editable=False)),
('order_no', models.ForeignKey(db_column='agent_id', on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')), ('item_id', models.ForeignKey(db_column='item_id', on_delete=django.db.models.deletion.CASCADE, to='products.product')),
('order_no', models.ForeignKey(db_column='order_no', on_delete=django.db.models.deletion.CASCADE, to='orders.order')),
], ],
options={ options={
'db_table': 'order_item', 'db_table': 'order_item',
}, },
), ),
migrations.CreateModel( migrations.AddField(
name='Order', model_name='order',
fields=[ name='items',
('Order_no', models.AutoField(primary_key=True, serialize=False)), field=models.ManyToManyField(through='orders.OrderItem', to='products.Product'),
('Order_date', models.DateField(auto_now_add=True)),
('delivery_date', models.DateField()),
('delivery_address', models.CharField(max_length=254)),
('gift', models.BooleanField()),
('recipient', models.CharField(max_length=50)),
('amount_due', models.IntegerField(default=0, editable=False)),
('agent_id', models.ForeignKey(db_column='agent_id', on_delete=django.db.models.deletion.CASCADE, to='adminpage.salesagent')),
('customer_id', models.ForeignKey(db_column='customer_id', on_delete=django.db.models.deletion.CASCADE, to='homepage.customer')),
],
options={
'db_table': 'order',
},
), ),
] ]
from django.db import models from django.db import models
from adminpage.models import SalesAgent, Product, Folder from products.models import Product
from users.models import Customer
from django.core.validators import MaxValueValidator, MinValueValidator
# Create your models here. # Create your models here.
class Customer(models.Model):
customer_id = models.AutoField(primary_key=True)
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
agent_id = models.ForeignKey(SalesAgent, on_delete=models.CASCADE, db_column='agent_id')
def __str__(self):
return self.first_name + " " + self.last_name
class Meta:
db_table = "customer"
class Order(models.Model): class Order(models.Model):
Order_no = models.AutoField(primary_key=True) order_no = models.AutoField(primary_key=True)
Order_date = models.DateField(auto_now_add=True) order_date = models.DateField(auto_now_add=True)
delivery_date = models.DateField() customer_id = models.ForeignKey(Customer, on_delete=models.CASCADE, db_column='customer_id')
items = models.ManyToManyField(Product, through='OrderItem', through_fields=('order_no', 'item_id'))
delivery_schedule = models.DateTimeField()
delivery_address = models.CharField(max_length=254) delivery_address = models.CharField(max_length=254)
gift = models.BooleanField() gift = models.BooleanField()
recipient = models.CharField(max_length=50) recipient = models.CharField(max_length=50)
amount_due = models.IntegerField(default=0, editable=False) amount_due = models.IntegerField(default=0, editable=False)
agent_id = models.ForeignKey(SalesAgent, on_delete=models.CASCADE, db_column='agent_id') def __str__(self):
customer_id = models.ForeignKey(Customer, on_delete=models.CASCADE, db_column='customer_id') return str(self.order_no)
items = models.ManyToManyField(Folder, through='OrderItem', through_fields=('order_no', 'item_id'))
class Meta: class Meta:
db_table = "order" db_table = "order"
class OrderItem(models.Model): class OrderItem(models.Model):
order_no = models.ForeignKey(Order, on_delete=models.CASCADE, db_column='order_no') order_no = models.ForeignKey(Order, on_delete=models.CASCADE, db_column='order_no')
item_id = models.ForeignKey(Folder, on_delete=models.CASCADE, db_column='item_id') item_id = models.ForeignKey(Product, on_delete=models.CASCADE, db_column='item_id')
quantity = models.IntegerField(default=1) color = models.CharField(max_length=20, choices=(("RED","Red"), ("ORANGE","Orange"), ("YELLOW", "Yellow"),
("GREEN", "Green"), ("BLUE", "Blue"), ("PURPLE", "Purple"), ("PINK", "Pink"), ("BLACK", "Black")))
quantity = models.IntegerField(default=1, validators=[MaxValueValidator(99), MinValueValidator(0)])
personalization = models.CharField(max_length=254) personalization = models.CharField(max_length=254)
discount = models.IntegerField(default=0, editable=False) discount = models.IntegerField(default=0, editable=False)
discount_price = models.IntegerField(default=0, editable=False) discount_price = models.IntegerField(default=0, editable=False)
def __str__(self):
return str(self.quantity) + " pcs. of " + str(self.item_id) + " added to order #" + str(self.order_no)
class Meta: class Meta:
db_table = "order_item" db_table = "order_item"
\ No newline at end of file
# Order(Order_no, Order_date, Delivery_Date, Delivery_Address, Gift?, Recipient, Amount_Due, Agent_ID, Customer_ID)
# OrderItem(Order_no, itemID, personalization, Discount, Discount Price)
\ No newline at end of file
<h1>This is the orders html</h1>
from django.urls import path from django.urls import path
from . import views from . import views
appname = "homepage" appname = "orders"
urlpatterns = [ urlpatterns = [
path('', views.index, name="index"), path('', views.index, name="index"),
] ]
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
# Create your views here. # Create your views here.
def index(request): def index(request):
return render(request, "homepage/homepage.html") return render(request, "orders/orders.html")
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment