From 7893b18c6beef43287ccf852f89b180a98bc4823 Mon Sep 17 00:00:00 2001 From: behruz-dev Date: Mon, 6 Oct 2025 18:15:58 +0500 Subject: [PATCH] fix --- .../migrations/0007_alter_product_name.py | 18 ++++++++++++++++++ core/apps/products/models/product.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 core/apps/products/migrations/0007_alter_product_name.py diff --git a/core/apps/products/migrations/0007_alter_product_name.py b/core/apps/products/migrations/0007_alter_product_name.py new file mode 100644 index 0000000..3042ee6 --- /dev/null +++ b/core/apps/products/migrations/0007_alter_product_name.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.4 on 2025-10-06 18:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('products', '0006_alter_product_type'), + ] + + operations = [ + migrations.AlterField( + model_name='product', + name='name', + field=models.CharField(max_length=200, unique=True), + ), + ] diff --git a/core/apps/products/models/product.py b/core/apps/products/models/product.py index 92166f3..167dd17 100644 --- a/core/apps/products/models/product.py +++ b/core/apps/products/models/product.py @@ -12,7 +12,7 @@ class Product(BaseModel): ("SERVICE", 'xizmat') ) - name = models.CharField(max_length=200) + name = models.CharField(max_length=200, unique=True) type = models.CharField(max_length=20, choices=TYPE, default="TANGIBLE") unity = models.ForeignKey( 'products.Unity', on_delete=models.SET_NULL, related_name='products', null=True