Интегрирован wesp в сайт
CI / quality (push) Canceled after 0s

This commit is contained in:
влад
2026-07-17 12:57:18 +03:00
parent 5dfa06ddbe
commit 355c0ef9f1
883 changed files with 194576 additions and 177 deletions
+12 -1
View File
@@ -154,7 +154,18 @@ def _apply_fields(row, data: dict[str, Any], model) -> None:
elif key not in ("enterprise_id", "created_at", "id"):
extra[key] = value
if model is ZootechRecipe and "ingredients" in data:
row.payload_json = json.dumps(data.get("ingredients"), ensure_ascii=False)
preserved: dict[str, Any] = {}
if row.payload_json:
try:
existing = json.loads(row.payload_json)
if isinstance(existing, dict) and existing.get("dispenser_id"):
preserved["dispenser_id"] = existing["dispenser_id"]
except json.JSONDecodeError:
pass
if preserved:
row.payload_json = json.dumps(preserved, ensure_ascii=False)
else:
row.payload_json = json.dumps(data.get("ingredients"), ensure_ascii=False)
elif extra and "payload_json" in allowed:
row.payload_json = json.dumps(extra, ensure_ascii=False)