vongol
September 18, 2017, 3:59pm
1
What data type does frappe.get_doc return? Is it a dictionary?
It’s a Document
object.
})
# create new object with keyword arguments
user = get_doc(doctype='User', email_id='test@example.com')
# select a document for update
user = get_doc("User", "test@example.com", for_update=True)
"""
if args:
if isinstance(args[0], BaseDocument):
# already a document
return args[0]
elif isinstance(args[0], str):
doctype = args[0]
elif isinstance(args[0], dict):
# passed a dict
kwargs = args[0]
else:
raise ValueError("First non keyword argument must be a string or dict")
You can call methods and access its fields as properties.
vongol
September 19, 2017, 11:51am
3
OK, cool. How about the object that functions like frappe.get_all return? According to one source, it’s a “list of dictionary objects,” which made no sense to me.