diff --git a/core/apps/products/management/commands/import_units.py b/core/apps/products/management/commands/import_units.py index 23855fc..efc2335 100644 --- a/core/apps/products/management/commands/import_units.py +++ b/core/apps/products/management/commands/import_units.py @@ -18,5 +18,4 @@ class Command(BaseCommand): Unity.objects.get_or_create( value=item['name']['uz'] ) - self.stdout.write("Units added") \ No newline at end of file diff --git a/core/apps/products/models/unity.py b/core/apps/products/models/unity.py index 7ac63c1..78013da 100644 --- a/core/apps/products/models/unity.py +++ b/core/apps/products/models/unity.py @@ -5,7 +5,7 @@ from core.apps.shared.models import BaseModel class Unity(BaseModel): - value = models.CharField(max_length=50) + value = models.CharField(max_length=50, unique=True) def __str__(self): return self.value