fix delete choice values

This commit is contained in:
pycook 2023-08-31 16:02:24 +08:00
parent e390b1ed7c
commit c74fee8aa9
1 changed files with 4 additions and 3 deletions

View File

@ -92,6 +92,7 @@ class AttributeManager(object):
def _del_choice_values(_id, value_type):
choice_table = ValueTypeMap.choice.get(value_type)
if choice_table is not None:
db.session.query(choice_table).filter(choice_table.attr_id == _id).delete()
db.session.flush()
@ -296,7 +297,7 @@ class AttributeManager(object):
if is_choice and choice_value:
self.add_choice_values(attr.id, attr.value_type, choice_value)
elif not is_choice:
elif existed2['is_choice']:
self._del_choice_values(attr.id, attr.value_type)
try: