summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspl3g <spleefer6@gmail.com>2026-05-30 15:07:25 +0300
committerspl3g <spleefer6@gmail.com>2026-05-30 15:07:25 +0300
commit0e8501aa8c55b02c5af5bf3fd51d764c786d77f6 (patch)
treef689755e783b0b2e6c34453fea564e0c746f9332
parentf20bcbc5926b5d02beefa855ece59e34704503ae (diff)
adjust the product model
-rw-r--r--core/migrations/0002_alter_product_supplier.py19
-rw-r--r--core/models.py2
2 files changed, 20 insertions, 1 deletions
diff --git a/core/migrations/0002_alter_product_supplier.py b/core/migrations/0002_alter_product_supplier.py
new file mode 100644
index 0000000..d54e7e4
--- /dev/null
+++ b/core/migrations/0002_alter_product_supplier.py
@@ -0,0 +1,19 @@
+# Generated by Django 6.0.5 on 2026-05-29 19:42
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='product',
+ name='supplier',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.supplier'),
+ ),
+ ]
diff --git a/core/models.py b/core/models.py
index dce67cf..db8b4c1 100644
--- a/core/models.py
+++ b/core/models.py
@@ -31,7 +31,7 @@ class Product(models.Model):
unit = models.CharField(max_length=20)
price = models.DecimalField(max_digits=20, decimal_places=2)
manufacturer = models.CharField(max_length=200)
- supplier = models.CharField(max_length=200)
+ supplier = models.ForeignKey(Supplier, on_delete=models.SET_NULL, null=True, blank=True)
category = models.CharField(max_length=100)
discount = models.DecimalField(max_digits=5, decimal_places=2, default=0)
quantity = models.IntegerField(default=0)