-
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.
Merge pull request #5 from Horlawhumy-dev/add-product-orders
Add product orders
- Loading branch information
Showing
15 changed files
with
520 additions
and
15 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
104 changes: 104 additions & 0 deletions
104
inventory/migrations/0003_alter_product_price_alter_product_quantity_order_and_more.py
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,104 @@ | ||
# Generated by Django 5.0.6 on 2024-07-02 09:46 | ||
|
||
import django.db.models.deletion | ||
import drugstoc_inventory.model_utils | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("inventory", "0002_alter_product_options"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="product", | ||
name="price", | ||
field=models.PositiveIntegerField(default=0), | ||
), | ||
migrations.AlterField( | ||
model_name="product", | ||
name="quantity", | ||
field=models.PositiveIntegerField(default=0), | ||
), | ||
migrations.CreateModel( | ||
name="Order", | ||
fields=[ | ||
( | ||
"id", | ||
models.CharField( | ||
default=drugstoc_inventory.model_utils.generate_id, | ||
editable=False, | ||
max_length=255, | ||
primary_key=True, | ||
serialize=False, | ||
), | ||
), | ||
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)), | ||
("updated_at", models.DateTimeField(auto_now=True, db_index=True)), | ||
( | ||
"active", | ||
models.BooleanField( | ||
db_index=True, default=True, verbose_name="active" | ||
), | ||
), | ||
( | ||
"status", | ||
models.CharField( | ||
choices=[ | ||
("pending", "Pending"), | ||
("completed", "Completed"), | ||
("cancelled", "Cancelled"), | ||
], | ||
default="pending", | ||
max_length=20, | ||
), | ||
), | ||
( | ||
"user", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
options={ | ||
"ordering": ["-created_at", "id"], | ||
"abstract": False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="OrderItem", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("quantity", models.PositiveIntegerField(default=0)), | ||
("price", models.PositiveIntegerField(default=0)), | ||
( | ||
"order", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="items", | ||
to="inventory.order", | ||
), | ||
), | ||
( | ||
"product", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="inventory.product", | ||
), | ||
), | ||
], | ||
), | ||
] |
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 5.0.6 on 2024-07-02 09:49 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("inventory", "0003_alter_product_price_alter_product_quantity_order_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name="order", | ||
old_name="user", | ||
new_name="owner", | ||
), | ||
] |
50 changes: 50 additions & 0 deletions
50
inventory/migrations/0005_alter_orderitem_options_orderitem_active_and_more.py
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,50 @@ | ||
# Generated by Django 5.0.6 on 2024-07-02 10:21 | ||
|
||
import django.utils.timezone | ||
import drugstoc_inventory.model_utils | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("inventory", "0004_rename_user_order_owner"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="orderitem", | ||
options={"ordering": ["-created_at", "id"]}, | ||
), | ||
migrations.AddField( | ||
model_name="orderitem", | ||
name="active", | ||
field=models.BooleanField( | ||
db_index=True, default=True, verbose_name="active" | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="orderitem", | ||
name="created_at", | ||
field=models.DateTimeField( | ||
auto_now_add=True, db_index=True, default=django.utils.timezone.now | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="orderitem", | ||
name="updated_at", | ||
field=models.DateTimeField(auto_now=True, db_index=True), | ||
), | ||
migrations.AlterField( | ||
model_name="orderitem", | ||
name="id", | ||
field=models.CharField( | ||
default=drugstoc_inventory.model_utils.generate_id, | ||
editable=False, | ||
max_length=255, | ||
primary_key=True, | ||
serialize=False, | ||
), | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
inventory/migrations/0006_rename_price_orderitem_total_price_and_more.py
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 @@ | ||
# Generated by Django 5.0.6 on 2024-07-02 11:19 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("inventory", "0005_alter_orderitem_options_orderitem_active_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name="orderitem", | ||
old_name="price", | ||
new_name="total_price", | ||
), | ||
migrations.RenameField( | ||
model_name="orderitem", | ||
old_name="quantity", | ||
new_name="total_quantity", | ||
), | ||
] |
21 changes: 21 additions & 0 deletions
21
inventory/migrations/0007_remove_orderitem_total_price_and_more.py
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,21 @@ | ||
# Generated by Django 5.0.6 on 2024-07-02 11:31 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("inventory", "0006_rename_price_orderitem_total_price_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="orderitem", | ||
name="total_price", | ||
), | ||
migrations.RemoveField( | ||
model_name="orderitem", | ||
name="total_quantity", | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
inventory/migrations/0008_orderitem_price_orderitem_quantity.py
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 @@ | ||
# Generated by Django 5.0.6 on 2024-07-02 12:52 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("inventory", "0007_remove_orderitem_total_price_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="orderitem", | ||
name="price", | ||
field=models.PositiveIntegerField(default=1), | ||
), | ||
migrations.AddField( | ||
model_name="orderitem", | ||
name="quantity", | ||
field=models.PositiveIntegerField(default=1), | ||
), | ||
] |
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,17 @@ | ||
# Generated by Django 5.0.6 on 2024-07-02 13:11 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("inventory", "0008_orderitem_price_orderitem_quantity"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="orderitem", | ||
name="price", | ||
), | ||
] |
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.