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:
parent
2212a7ccb6
commit
1fed75584e
3 changed files with 17 additions and 1 deletions
16
core/migrations/0047_alter_attribute_unique_together.py
Normal file
16
core/migrations/0047_alter_attribute_unique_together.py
Normal 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")},
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
1
core/vendors/__init__.py
vendored
1
core/vendors/__init__.py
vendored
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue