From 0e8501aa8c55b02c5af5bf3fd51d764c786d77f6 Mon Sep 17 00:00:00 2001 From: spl3g Date: Sat, 30 May 2026 15:07:25 +0300 Subject: adjust the product model --- core/migrations/0002_alter_product_supplier.py | 19 +++++++++++++++++++ core/models.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 core/migrations/0002_alter_product_supplier.py 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) -- cgit v1.2.3