fix(docref): json serialization (#28182)
This commit is contained in:
parent
8b1180ba27
commit
75b58802ad
2 changed files with 6 additions and 3 deletions
|
|
@ -5,19 +5,18 @@ fail_fast: false
|
|||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
files: "frappe.*"
|
||||
exclude: ".*json$|.*txt$|.*csv|.*md|.*svg"
|
||||
- id: check-yaml
|
||||
- id: no-commit-to-branch
|
||||
args: ['--branch', 'develop']
|
||||
- id: check-merge-conflict
|
||||
- id: check-ast
|
||||
- id: check-json
|
||||
- id: check-toml
|
||||
- id: check-yaml
|
||||
# - id: check-yaml
|
||||
- id: debug-statements
|
||||
exclude: ^frappe/tests/classes/context_managers\.py$
|
||||
|
||||
|
|
|
|||
|
|
@ -221,6 +221,10 @@ def json_handler(obj):
|
|||
|
||||
elif isinstance(obj, frappe.model.document.BaseDocument):
|
||||
return obj.as_dict(no_nulls=True)
|
||||
|
||||
elif isinstance(obj, frappe.model.document.DocRef): # if not BaseDocument, but DocRef
|
||||
return str(obj)
|
||||
|
||||
elif isinstance(obj, Iterable):
|
||||
return list(obj)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue