Compare commits
2 Commits
47f7e8e5c1
...
339fccf6d2
| Author | SHA1 | Date | |
|---|---|---|---|
| 339fccf6d2 | |||
| 84f1453856 |
@ -32,8 +32,19 @@ try:
|
|||||||
data['product_type'] = ''
|
data['product_type'] = ''
|
||||||
data['product_type_title'] = ''
|
data['product_type_title'] = ''
|
||||||
|
|
||||||
|
# Ensure all table fields have values, filter out unknown fields
|
||||||
|
all_fields = ['id', 'parent_id', 'name', 'description', 'has_product',
|
||||||
|
'product_type', 'product_type_title', 'sort_order', 'icon',
|
||||||
|
'status', 'org_id', 'created_by', 'created_at', 'updated_at']
|
||||||
|
fields = {}
|
||||||
|
for k in all_fields:
|
||||||
|
if k in data:
|
||||||
|
fields[k] = data[k] if data[k] is not None else ''
|
||||||
|
else:
|
||||||
|
fields[k] = ''
|
||||||
|
|
||||||
async with DBPools().sqlorContext(dbname) as sor:
|
async with DBPools().sqlorContext(dbname) as sor:
|
||||||
await sor.C('product_category', data)
|
await sor.C('product_category', fields)
|
||||||
_new_rows = await sor.sqlExe("SELECT * FROM product_category WHERE id = ${id}$", {'id': data['id']})
|
_new_rows = await sor.sqlExe("SELECT * FROM product_category WHERE id = ${id}$", {'id': data['id']})
|
||||||
_user_data = _new_rows[0] if _new_rows else data
|
_user_data = _new_rows[0] if _new_rows else data
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user