Skip to content

Commit

Permalink
Set the default stock level to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
proffalken committed Nov 18, 2023
1 parent 66ae7a8 commit af8ca7b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions memberportal/api_shop/migrations/0003_product_qty_in_stock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.22 on 2023-11-18 20:19

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("api_shop", "0002_auto_20231119_0615"),
]

operations = [
migrations.AddField(
model_name="product",
name="qty_in_stock",
field=models.IntegerField(default=0),
preserve_default=False,
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.22 on 2023-11-18 20:19

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("api_shop", "0003_product_qty_in_stock"),
]

operations = [
migrations.AlterField(
model_name="product",
name="qty_in_stock",
field=models.IntegerField(default=0),
),
]
1 change: 1 addition & 0 deletions memberportal/api_shop/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Product(models.Model):
buy_price = models.DecimalField(max_digits=6, decimal_places=2)
sell_price = models.DecimalField(max_digits=6, decimal_places=2)
memberbucks_only = models.BooleanField(default=True)
qty_in_stock = models.IntegerField(default=0)

def __str__(self):
return f"{{ self.name }} - {{ self.description }} - {{ self.sell_price }}"
Expand Down

0 comments on commit af8ca7b

Please sign in to comment.