Features: 1) Add migration to enforce unique constraint on Attribute model for fields name, group, and value_type;

Fixes: 1) Remove redundant traceback logging in `core/vendors/__init__.py`;

Extra: 1) Update Attribute model's `unique_together` to include `value_type`.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-10-19 00:16:57 +03:00
parent 2212a7ccb6
commit 1fed75584e
3 changed files with 17 additions and 1 deletions

View file

@ -0,0 +1,16 @@
# Generated by Django 5.2 on 2025-10-18 21:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("core", "0046_alter_attribute_name_alter_attribute_name_ar_ar_and_more"),
]
operations = [
migrations.AlterUniqueTogether(
name="attribute",
unique_together={("name", "group", "value_type")},
),
]

View file

@ -667,6 +667,7 @@ class Attribute(ExportModelOperationsMixin("attribute"), NiceModel): # type: ig
unique_together = ( unique_together = (
"name", "name",
"group", "group",
"value_type",
) )
verbose_name = _("attribute") verbose_name = _("attribute")
verbose_name_plural = _("attributes") verbose_name_plural = _("attributes")

View file

@ -451,7 +451,6 @@ class AbstractVendor:
attribute.save() attribute.save()
except IntegrityError: except IntegrityError:
async_logger.warning(f"IntegrityError while processing attribute {key!r}...") async_logger.warning(f"IntegrityError while processing attribute {key!r}...")
async_logger.warning(traceback.format_exc())
return return
attribute.save() attribute.save()