Hi I tested this code
@frappe.whitelist(allow_guest=True)
def build_todo():
todo = frappe.get_doc({“doctype”:“ToDo”, “description”: “test”})
todo.insert()
return todo.name
it works and returns a valid name, but the todo does not show in todo module on the website.
Can some one please help me with this.
@YuaShizuki it’s not related with a internal user, because do you allow_guest, maybe you can force a user to create this, passing too, owner
and modified_by
as variables in the dictionary
1 Like
I don’t understand you.
I cant create a instance of a doctype that is visible on the website, ie I have to force the user to manually create this doctype, or am i missing something?
@YuaShizuki, Desk
and WebSite
are distinct things!
If you need show it in the WebSite
, do you need do it by coding, not only allowing it by guest.
The frappe.whitelist(allow_guest)
only allow a not logged user to create a todo.
To show it in the website, do you need create a template
and a context
to it be rendered for not logged users.
1 Like
No I want to show it in the todo list, on the desk. my above code does not work.
nor does this code works.
@frappe.whitelist()
def build_todo():
todo = frappe.get_doc({“doctype”:“ToDo”, “description”: “Testicular Cancer”, “status”:“Open”})
todo.insert(ignore_permissions=True)
todo.submit()
return todo.name
@YuaShizuki, use bench console
and put this in the console
for d in frappe.get_all("ToDo", fields=["*"]):
print d["description"]
1 Like
Yup I cant see them there either.
I only see
“push to github”
which I created manually.
Try after “insert” use frappe.db.commit()
4 Likes
IT WORKS !!!
Thanks a lot man, I really appreciate.
This topic was automatically closed after 32 hours. New replies are no longer allowed.