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